From: NeilBrown <neilb@suse.de>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: nfs@lists.sourceforge.net, linux-kernel@vger.kernel.org
Cc: Christoph Hellwig <hch@infradead.org>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Neil Brown <neilb@suse.de>
Subject: [PATCH 005 of 8] knfsd: exportfs: untangle ISDIR logic in find_exported_dentry
Date: Tue, 15 May 2007 17:16:36 +1000 [thread overview]
Message-ID: <1070515071636.16315@suse.de> (raw)
In-Reply-To: 20070515170405.15621.patches@notabene
From: Christoph Hellwig <hch@infradead.org>
Rework some logic in find_exported_dentry so that we only have a single
S_ISDIR check and logic that makes clear to the reader what we're really
doing here.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Neil Brown <neilb@suse.de>
### Diffstat output
./fs/exportfs/expfs.c | 26 ++++++++++----------------
1 file changed, 10 insertions(+), 16 deletions(-)
diff .prev/fs/exportfs/expfs.c ./fs/exportfs/expfs.c
--- .prev/fs/exportfs/expfs.c 2007-05-14 11:15:34.000000000 +1000
+++ ./fs/exportfs/expfs.c 2007-05-14 11:15:37.000000000 +1000
@@ -116,30 +116,23 @@ find_exported_dentry(struct super_block
if (IS_ERR(result))
return result;
- if (S_ISDIR(result->d_inode->i_mode) &&
- (result->d_flags & DCACHE_DISCONNECTED)) {
- /* it is an unconnected directory, we must connect it */
- ;
- } else {
- if (acceptable(context, result))
- return result;
- if (S_ISDIR(result->d_inode->i_mode)) {
+ if (S_ISDIR(result->d_inode->i_mode)) {
+ if (!(result->d_flags & DCACHE_DISCONNECTED)) {
+ if (acceptable(context, result))
+ return result;
err = -EACCES;
goto err_result;
}
+ target_dir = dget(result);
+ } else {
+ if (acceptable(context, result))
+ return result;
+
alias = find_acceptable_alias(result, acceptable, context);
if (alias)
return alias;
- }
- /* It's a directory, or we are required to confirm the file's
- * location in the tree based on the parent information
- */
- dprintk("find_exported_dentry: need to look harder for %s/%d\n",sb->s_id,*(int*)obj);
- if (S_ISDIR(result->d_inode->i_mode))
- target_dir = dget(result);
- else {
if (parent == NULL)
goto err_result;
@@ -149,6 +142,7 @@ find_exported_dentry(struct super_block
goto err_result;
}
}
+
/*
* Now we need to make sure that target_dir is properly connected.
* It may already be, as the flag isn't always updated when connection
next prev parent reply other threads:[~2007-05-15 7:16 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-05-15 7:15 [PATCH 000 of 8] knfsd: cleanups for exportfs code NeilBrown
2007-05-15 7:16 ` [PATCH 001 of 8] knfsd: exportfs: add exportfs.h header NeilBrown
2007-05-15 7:16 ` NeilBrown
2007-05-15 7:16 ` [PATCH 002 of 8] knfsd: exportfs: remove iget abuse NeilBrown
2007-05-15 7:16 ` NeilBrown
2007-05-15 12:30 ` Dave Kleikamp
2007-05-15 7:16 ` [PATCH 003 of 8] knfsd: exportfs: add procedural interface for NFSD NeilBrown
2007-05-15 7:16 ` NeilBrown
2007-05-15 7:16 ` [PATCH 004 of 8] knfsd: exportfs: remove CALL macro NeilBrown
2007-05-15 7:16 ` NeilBrown
2007-05-15 7:16 ` NeilBrown [this message]
2007-05-15 7:16 ` [PATCH 006 of 8] knfsd: exportfs: move acceptable check into find_acceptable_alias NeilBrown
2007-05-15 7:16 ` NeilBrown
2007-05-15 7:16 ` [PATCH 007 of 8] knfsd: exportfs: add find_disconnected_root helper NeilBrown
2007-05-15 7:16 ` NeilBrown
2007-05-15 7:16 ` [PATCH 008 of 8] knfsd: exportfs: split out reconnecting a dentry from find_exported_dentry NeilBrown
2007-05-15 7:16 ` NeilBrown
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1070515071636.16315@suse.de \
--to=neilb@suse.de \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nfs@lists.sourceforge.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.