Skip to content

Commit

Permalink
sheepdog: change a method for detecting invalidation of inode
Browse files Browse the repository at this point in the history
Current method of detecting invalidation of inode can produce bunch of
error messages if a first object of VDI doesn't exist. This patch
updates the method: reading first one byte of inode object. It can
reduce needless and confusing error messages.

Signed-off-by: Hitoshi Mitake <mitake.hitoshi@lab.ntt.co.jp>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
  • Loading branch information
mitake authored and fujita committed Sep 27, 2014
1 parent ff1de6c commit 4f539c5
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions usr/bs_sheepdog.c
Expand Up @@ -817,18 +817,16 @@ static int is_refresh_required(struct sheepdog_access_info *ai)
* 1: refresh is required
*/
{
uint64_t first_oid = vid_to_data_oid(ai->inode.vdi_id, 0);
uint64_t inode_oid = vid_to_vdi_oid(ai->inode.vdi_id);
char dummy;
int need_reload_inode = 0;

/*
* Check inode of this tgtd is invaldiated or not.
* Reading which object isn't a problem. If the inode object is
* invalidated, sheep returns SD_RES_INODE_INVALIDATED even if the
* object doesn't exist. So we read the first one.
* The inode object is the only one object which always exists.
*/

read_object(ai, &dummy, first_oid, ai->inode.nr_copies, sizeof(dummy),
read_object(ai, &dummy, inode_oid, ai->inode.nr_copies, sizeof(dummy),
0, &need_reload_inode);

return need_reload_inode;
Expand Down

0 comments on commit 4f539c5

Please sign in to comment.