[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <9180.1240468823@jrobl>
Date: Thu, 23 Apr 2009 15:40:23 +0900
From: hooanon05@...oo.co.jp
To: "J. Bruce Fields" <bfields@...ldses.org>
Cc: David Woodhouse <dwmw2@...radead.org>,
Al Viro <viro@...IV.linux.org.uk>, hch@...radead.org,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"linux-fsdevel@...r.kernel.org" <linux-fsdevel@...r.kernel.org>
Subject: Re: [PATCH v2] Fix i_mutex handling in nfsd readdir
"J. Bruce Fields":
> > Isn't it better to test it BEFORE fh_compose()?
:::
> Yes, I think you're right.
Then here you are.
J. R. Okajima
----------------------------------------------------------------------
commit c98c6c4a207d602bd9498ea5f1d2993a00e98445
Author: J. R. Okajima <hooanon05@...oo.co.jp>
Date: Thu Apr 23 15:38:43 2009 +0900
NFSD: test d_inode before fh_compose()
After 2f9092e1020246168b1309b35e085ecd7ff9ff72 "Fix i_mutex vs. readdir
handling in nfsd" (and 14f7dd63 "Copy XFS readdir hack into nfsd code"),
an entry may be removed between the first mutex_unlock and the second
mutex_lock. In this case, lookup_one_len() in compose_entry_fh() will
return a negative dentry.
It is better to test inode (positive/negative) BEFORE fh_compose().
Signed-off-by: J. R. Okajima <hooanon05@...oo.co.jp>
diff --git a/fs/nfsd/nfs3xdr.c b/fs/nfsd/nfs3xdr.c
index 17d0dd9..1b5543b 100644
--- a/fs/nfsd/nfs3xdr.c
+++ b/fs/nfsd/nfs3xdr.c
@@ -851,8 +851,8 @@ compose_entry_fh(struct nfsd3_readdirres *cd, struct svc_fh *fhp,
if (IS_ERR(dchild))
return 1;
if (d_mountpoint(dchild) ||
- fh_compose(fhp, exp, dchild, &cd->fh) != 0 ||
- !dchild->d_inode)
+ !dchild->d_inode ||
+ fh_compose(fhp, exp, dchild, &cd->fh) != 0)
rv = 1;
dput(dchild);
return rv;
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists