From mboxrd@z Thu Jan 1 00:00:00 1970 From: =?UTF-8?B?7J207LC966eM?= Subject: RE: [f2fs-dev] [PATCH v2] f2fs: fix up f2fs_get_parent issue to retrieve correct parent inode number Date: Fri, 14 Dec 2012 08:09:28 +0900 Message-ID: <060d01cdd986$e708a180$b519e480$%lee@samsung.com> References: <1355409851-6389-1-git-send-email-linkinjeon@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Cc: 'Amit Sahrawat' , 'Namjae Jeon' , linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, linux-fsdevel@vger.kernel.org To: 'Namjae Jeon' , jaegeuk.kim@samsung.com Return-path: In-reply-to: <1355409851-6389-1-git-send-email-linkinjeon@gmail.com> Content-language: ko Sender: linux-kernel-owner@vger.kernel.org List-Id: linux-fsdevel.vger.kernel.org > -----Original Message----- > From: Namjae Jeon [mailto:linkinjeon@gmail.com] > Sent: Thursday, December 13, 2012 11:44 PM > To: jaegeuk.kim@samsung.com > Cc: Namjae Jeon; Amit Sahrawat; Namjae Jeon; linux-kernel@vger.kernel.org; > linux-f2fs-devel@lists.sourceforge.net; linux-fsdevel@vger.kernel.org > Subject: [f2fs-dev] [PATCH v2] f2fs: fix up f2fs_get_parent issue to > retrieve correct parent inode number > > From: Namjae Jeon > > Test Case: > [NFS Client] > ls -lR . > > [NFS Server] > while [ 1 ] > do > echo 3 > /proc/sys/vm/drop_caches > done > > Error on NFS Client: "No such file or directory" > > When cache is dropped at the server, it results in lookup failure at the > NFS client due to non-connection with the parent. The default path is it > initiates a lookup by calculating the hash value for the name, even though > the hash values stored on the disk for "." and ".." is maintained as zero, > which results in failure from find_in_block due to not matching HASH values. > Fix up, by using the correct hashing values for these entries. > > Signed-off-by: Namjae Jeon > Signed-off-by: Amit Sahrawat > Signed-off-by: Jaegeuk Kim > --- > fs/f2fs/dir.c | 4 ++-- > fs/f2fs/hash.c | 4 ++++ > 2 files changed, 6 insertions(+), 2 deletions(-) > > diff --git a/fs/f2fs/dir.c b/fs/f2fs/dir.c > index b4e24f3..a158406 100644 > --- a/fs/f2fs/dir.c > +++ b/fs/f2fs/dir.c > @@ -540,13 +540,13 @@ int f2fs_make_empty(struct inode *inode, struct inode > *parent) > > de = &dentry_blk->dentry[0]; > de->name_len = cpu_to_le16(1); > - de->hash_code = 0; > + de->hash_code = f2fs_dentry_hash(".", 1); > de->ino = cpu_to_le32(inode->i_ino); > memcpy(dentry_blk->filename[0], ".", 1); > set_de_type(de, inode); > > de = &dentry_blk->dentry[1]; > - de->hash_code = 0; > + de->hash_code = f2fs_dentry_hash("..", 2); > de->name_len = cpu_to_le16(2); > de->ino = cpu_to_le32(parent->i_ino); > memcpy(dentry_blk->filename[1], "..", 2); > diff --git a/fs/f2fs/hash.c b/fs/f2fs/hash.c > index a60f042..5e48bac 100644 > --- a/fs/f2fs/hash.c > +++ b/fs/f2fs/hash.c > @@ -76,6 +76,10 @@ f2fs_hash_t f2fs_dentry_hash(const char *name, int len) > const char *p; > __u32 in[8], buf[4]; > > + if ((len <= 2) && (name[0] == '.') && > + (name[1] == '.' || name[1] == '\0')) > + return 0; > + How about this? if (!memcmp(name, ".", len) || !memcmp(name, "..", len)) return 0; > /* Initialize the default seed for the hash checksum functions */ > buf[0] = 0x67452301; > buf[1] = 0xefcdab89; > -- > 1.7.9.5 > > > --------------------------------------------------------------------------- > --- > LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial > Remotely access PCs and mobile devices and provide instant support > Improve your efficiency, and focus on delivering more value-add services > Discover what IT Professionals Know. Rescue delivers > http://p.sf.net/sfu/logmein_12329d2d > _______________________________________________ > Linux-f2fs-devel mailing list > Linux-f2fs-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel