Skip to content

Commit

Permalink
cifs: new helper function: cifs_revalidate_mapping
Browse files Browse the repository at this point in the history
Consolidate a bit of code. In a later patch we'll expand this to fix
some races.

Signed-off-by: Jeff Layton <jlayton@poochiereds.net>
Signed-off-by: Steve French <smfrench@gmail.com>
  • Loading branch information
Jeff Layton authored and Steve French committed May 21, 2014
1 parent aff8d5c commit e284e53
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
1 change: 1 addition & 0 deletions fs/cifs/cifsfs.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ extern int cifs_revalidate_dentry_attr(struct dentry *);
extern int cifs_revalidate_file(struct file *filp);
extern int cifs_revalidate_dentry(struct dentry *);
extern int cifs_invalidate_mapping(struct inode *inode);
extern int cifs_revalidate_mapping(struct inode *inode);
extern int cifs_getattr(struct vfsmount *, struct dentry *, struct kstat *);
extern int cifs_setattr(struct dentry *, struct iattr *);

Expand Down
16 changes: 10 additions & 6 deletions fs/cifs/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -1779,6 +1779,14 @@ cifs_invalidate_mapping(struct inode *inode)
return rc;
}

int
cifs_revalidate_mapping(struct inode *inode)
{
if (test_bit(CIFS_INO_INVALID_MAPPING, &CIFS_I(inode)->flags))
return cifs_invalidate_mapping(inode);
return 0;
}

int cifs_revalidate_file_attr(struct file *filp)
{
int rc = 0;
Expand Down Expand Up @@ -1845,9 +1853,7 @@ int cifs_revalidate_file(struct file *filp)
if (rc)
return rc;

if (test_bit(CIFS_INO_INVALID_MAPPING, &CIFS_I(inode)->flags))
rc = cifs_invalidate_mapping(inode);
return rc;
return cifs_revalidate_mapping(inode);
}

/* revalidate a dentry's inode attributes */
Expand All @@ -1860,9 +1866,7 @@ int cifs_revalidate_dentry(struct dentry *dentry)
if (rc)
return rc;

if (test_bit(CIFS_INO_INVALID_MAPPING, &CIFS_I(inode)->flags))
rc = cifs_invalidate_mapping(inode);
return rc;
return cifs_revalidate_mapping(inode);
}

int cifs_getattr(struct vfsmount *mnt, struct dentry *dentry,
Expand Down

0 comments on commit e284e53

Please sign in to comment.