Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755473Ab0K3Rm6 (ORCPT ); Tue, 30 Nov 2010 12:42:58 -0500 Received: from mx2.netapp.com ([216.240.18.37]:19651 "EHLO mx2.netapp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754855Ab0K3Rm5 (ORCPT ); Tue, 30 Nov 2010 12:42:57 -0500 X-IronPort-AV: E=Sophos;i="4.59,281,1288594800"; d="scan'208";a="489042104" From: Trond Myklebust To: Linus Torvalds Cc: Linux Kernel Mailing List , linux-nfs@vger.kernel.org, Trond Myklebust Subject: [PATCH] NFS: Fix a readdirplus bug Date: Tue, 30 Nov 2010 12:42:34 -0500 Message-Id: <1291138954-10310-1-git-send-email-Trond.Myklebust@netapp.com> X-Mailer: git-send-email 1.7.3.2 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1238 Lines: 37 When comparing filehandles in the helper nfs_same_file(), we should not be using 'strncmp()': filehandles are not null terminated strings. Instead, we should just use the existing helper nfs_compare_fh(). Signed-off-by: Trond Myklebust --- fs/nfs/dir.c | 6 +----- 1 files changed, 1 insertions(+), 5 deletions(-) diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c index 8ea4a41..f0a384e 100644 --- a/fs/nfs/dir.c +++ b/fs/nfs/dir.c @@ -395,13 +395,9 @@ int xdr_decode(nfs_readdir_descriptor_t *desc, struct nfs_entry *entry, struct x static int nfs_same_file(struct dentry *dentry, struct nfs_entry *entry) { - struct nfs_inode *node; if (dentry->d_inode == NULL) goto different; - node = NFS_I(dentry->d_inode); - if (node->fh.size != entry->fh->size) - goto different; - if (strncmp(node->fh.data, entry->fh->data, node->fh.size) != 0) + if (nfs_compare_fh(entry->fh, NFS_FH(dentry->d_inode)) != 0) goto different; return 1; different: -- 1.7.3.2 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/