diff options
author | Jeff Layton <jlayton@redhat.com> | 2011-01-07 11:30:27 -0500 |
---|---|---|
committer | Steve French <sfrench@us.ibm.com> | 2011-01-09 18:43:00 -0500 |
commit | 20054bd65703f7504a9daceabc2a060828fde36c (patch) | |
tree | a15151a2d3a1d8abe1c72701ceb3e9f7051fe6ea /fs/cifs/inode.c | |
parent | d44a9fe2c8af3fee8edb203e9b11e507851c50fa (diff) |
cifs: use CreationTime like an i_generation field
Reduce false inode collisions by using the CreationTime like an
i_generation field. This way, even if the server ends up reusing
a uniqueid after a delete/create cycle, we can avoid matching
the inode incorrectly.
Signed-off-by: Jeff Layton <jlayton@redhat.com>
Signed-off-by: Steve French <sfrench@us.ibm.com>
Diffstat (limited to 'fs/cifs/inode.c')
-rw-r--r-- | fs/cifs/inode.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c index a853a89857a5..0c7e36910e31 100644 --- a/fs/cifs/inode.c +++ b/fs/cifs/inode.c | |||
@@ -518,6 +518,7 @@ cifs_all_info_to_fattr(struct cifs_fattr *fattr, FILE_ALL_INFO *info, | |||
518 | 518 | ||
519 | fattr->cf_eof = le64_to_cpu(info->EndOfFile); | 519 | fattr->cf_eof = le64_to_cpu(info->EndOfFile); |
520 | fattr->cf_bytes = le64_to_cpu(info->AllocationSize); | 520 | fattr->cf_bytes = le64_to_cpu(info->AllocationSize); |
521 | fattr->cf_createtime = le64_to_cpu(info->CreationTime); | ||
521 | 522 | ||
522 | if (fattr->cf_cifsattrs & ATTR_DIRECTORY) { | 523 | if (fattr->cf_cifsattrs & ATTR_DIRECTORY) { |
523 | fattr->cf_mode = S_IFDIR | cifs_sb->mnt_dir_mode; | 524 | fattr->cf_mode = S_IFDIR | cifs_sb->mnt_dir_mode; |
@@ -779,6 +780,10 @@ cifs_find_inode(struct inode *inode, void *opaque) | |||
779 | if (CIFS_I(inode)->uniqueid != fattr->cf_uniqueid) | 780 | if (CIFS_I(inode)->uniqueid != fattr->cf_uniqueid) |
780 | return 0; | 781 | return 0; |
781 | 782 | ||
783 | /* use createtime like an i_generation field */ | ||
784 | if (CIFS_I(inode)->createtime != fattr->cf_createtime) | ||
785 | return 0; | ||
786 | |||
782 | /* don't match inode of different type */ | 787 | /* don't match inode of different type */ |
783 | if ((inode->i_mode & S_IFMT) != (fattr->cf_mode & S_IFMT)) | 788 | if ((inode->i_mode & S_IFMT) != (fattr->cf_mode & S_IFMT)) |
784 | return 0; | 789 | return 0; |
@@ -796,6 +801,7 @@ cifs_init_inode(struct inode *inode, void *opaque) | |||
796 | struct cifs_fattr *fattr = (struct cifs_fattr *) opaque; | 801 | struct cifs_fattr *fattr = (struct cifs_fattr *) opaque; |
797 | 802 | ||
798 | CIFS_I(inode)->uniqueid = fattr->cf_uniqueid; | 803 | CIFS_I(inode)->uniqueid = fattr->cf_uniqueid; |
804 | CIFS_I(inode)->createtime = fattr->cf_createtime; | ||
799 | return 0; | 805 | return 0; |
800 | } | 806 | } |
801 | 807 | ||