All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hitoshi Mitake <mitake.hitoshi@lab.ntt.co.jp>
To: stgt@vger.kernel.org
Cc: Hitoshi Mitake <mitake.hitoshi@lab.ntt.co.jp>,
	Teruaki Ishizaki <ishizaki.teruaki@lab.ntt.co.jp>,
	Takashi Menjo <menjo.takashi@lab.ntt.co.jp>
Subject: [PATCH 3/6] sheepdog: pass a correct flag to reload_inode()
Date: Tue,  6 Sep 2016 16:37:26 +0900	[thread overview]
Message-ID: <1473147449-29377-4-git-send-email-mitake.hitoshi@lab.ntt.co.jp> (raw)
In-Reply-To: <1473147449-29377-1-git-send-email-mitake.hitoshi@lab.ntt.co.jp>

Current usage of reload_inode() is invalid because it is called with
is_snapshot == 0 even for a case of readonly. This patch fixes the
problem.

Cc: Teruaki Ishizaki <ishizaki.teruaki@lab.ntt.co.jp>
Cc: Takashi Menjo <menjo.takashi@lab.ntt.co.jp>
Tested-by: Takashi Menjo <menjo.takashi@lab.ntt.co.jp>
Signed-off-by: Hitoshi Mitake <mitake.hitoshi@lab.ntt.co.jp>
---
 usr/bs_sheepdog.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/usr/bs_sheepdog.c b/usr/bs_sheepdog.c
index be6d321..ecb5033 100644
--- a/usr/bs_sheepdog.c
+++ b/usr/bs_sheepdog.c
@@ -905,6 +905,7 @@ static int sd_io(struct sheepdog_access_info *ai, int write, char *buf, int len,
 	int need_update_inode = 0, need_reload_inode;
 	int nr_copies = ai->inode.nr_copies;
 	int need_write_lock, check_idx;
+	int read_reload_snap = 0;
 
 	goto do_req;
 
@@ -912,7 +913,7 @@ reload_in_read_path:
 	pthread_rwlock_unlock(&ai->inode_lock); /* unlock current read lock */
 
 	pthread_rwlock_wrlock(&ai->inode_lock);
-	ret = reload_inode(ai, 0);
+	ret = reload_inode(ai, read_reload_snap);
 	if (ret) {
 		eprintf("failed to reload in read path\n");
 		goto out;
@@ -1008,6 +1009,8 @@ retry:
 					dprintf("reload in read path for not"\
 						" written area\n");
 					size = orig_size;
+					read_reload_snap =
+						need_reload_inode == 1;
 					goto reload_in_read_path;
 				}
 			}
@@ -1019,6 +1022,7 @@ retry:
 			if (need_reload_inode) {
 				dprintf("reload in ordinal read path\n");
 				size = orig_size;
+				read_reload_snap = need_reload_inode == 1;
 				goto reload_in_read_path;
 			}
 		}
-- 
2.7.4

  parent reply	other threads:[~2016-09-06  7:37 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-06  7:37 [PATCH 0/6] sheepdog driver cleanup Hitoshi Mitake
2016-09-06  7:37 ` [PATCH 1/6] sheepdog: prevent double locking during inode reload Hitoshi Mitake
2016-09-06  7:37 ` [PATCH 2/6] sheepdog: serialize overwrapping request Hitoshi Mitake
2016-09-06  7:37 ` Hitoshi Mitake [this message]
2016-09-06  7:37 ` [PATCH 4/6] sheepdog: handle a case of snapshot -> failover Hitoshi Mitake
2016-09-06  7:37 ` [PATCH 5/6] sheepdog: don't let ai have min and max dirty data indexes Hitoshi Mitake
2016-09-06  7:37 ` [PATCH 6/6] sheepdog: handle an inconsistent state of metadata Hitoshi Mitake
2016-09-07  0:24 ` [PATCH 0/6] sheepdog driver cleanup FUJITA Tomonori

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1473147449-29377-4-git-send-email-mitake.hitoshi@lab.ntt.co.jp \
    --to=mitake.hitoshi@lab.ntt.co.jp \
    --cc=ishizaki.teruaki@lab.ntt.co.jp \
    --cc=menjo.takashi@lab.ntt.co.jp \
    --cc=stgt@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.