diff options
| author | Christoph Hellwig <hch@infradead.org> | 2007-07-17 07:04:31 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-07-17 13:23:06 -0400 |
| commit | d7dd618a5901ce0b44ef518208b35f728775db74 (patch) | |
| tree | 689e0e53091072cd5bf387f047c7fb55793f402d /fs/exportfs | |
| parent | 10f11c341da8c0ec6b8b024e892108a6537ba8c4 (diff) | |
knfsd: exportfs: untangle ISDIR logic in find_exported_dentry
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>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/exportfs')
| -rw-r--r-- | fs/exportfs/expfs.c | 26 |
1 files changed, 10 insertions, 16 deletions
diff --git a/fs/exportfs/expfs.c b/fs/exportfs/expfs.c index 1e6f556514d6..abf0a316aa1a 100644 --- a/fs/exportfs/expfs.c +++ b/fs/exportfs/expfs.c | |||
| @@ -116,30 +116,23 @@ find_exported_dentry(struct super_block *sb, void *obj, void *parent, | |||
| 116 | if (IS_ERR(result)) | 116 | if (IS_ERR(result)) |
| 117 | return result; | 117 | return result; |
| 118 | 118 | ||
| 119 | if (S_ISDIR(result->d_inode->i_mode) && | 119 | if (S_ISDIR(result->d_inode->i_mode)) { |
| 120 | (result->d_flags & DCACHE_DISCONNECTED)) { | 120 | if (!(result->d_flags & DCACHE_DISCONNECTED)) { |
| 121 | /* it is an unconnected directory, we must connect it */ | 121 | if (acceptable(context, result)) |
| 122 | ; | 122 | return result; |
| 123 | } else { | ||
| 124 | if (acceptable(context, result)) | ||
| 125 | return result; | ||
| 126 | if (S_ISDIR(result->d_inode->i_mode)) { | ||
| 127 | err = -EACCES; | 123 | err = -EACCES; |
| 128 | goto err_result; | 124 | goto err_result; |
| 129 | } | 125 | } |
| 130 | 126 | ||
| 127 | target_dir = dget(result); | ||
| 128 | } else { | ||
| 129 | if (acceptable(context, result)) | ||
| 130 | return result; | ||
| 131 | |||
| 131 | alias = find_acceptable_alias(result, acceptable, context); | 132 | alias = find_acceptable_alias(result, acceptable, context); |
| 132 | if (alias) | 133 | if (alias) |
| 133 | return alias; | 134 | return alias; |
| 134 | } | ||
| 135 | 135 | ||
| 136 | /* It's a directory, or we are required to confirm the file's | ||
| 137 | * location in the tree based on the parent information | ||
| 138 | */ | ||
| 139 | dprintk("find_exported_dentry: need to look harder for %s/%d\n",sb->s_id,*(int*)obj); | ||
| 140 | if (S_ISDIR(result->d_inode->i_mode)) | ||
| 141 | target_dir = dget(result); | ||
| 142 | else { | ||
| 143 | if (parent == NULL) | 136 | if (parent == NULL) |
| 144 | goto err_result; | 137 | goto err_result; |
| 145 | 138 | ||
| @@ -149,6 +142,7 @@ find_exported_dentry(struct super_block *sb, void *obj, void *parent, | |||
| 149 | goto err_result; | 142 | goto err_result; |
| 150 | } | 143 | } |
| 151 | } | 144 | } |
| 145 | |||
| 152 | /* | 146 | /* |
| 153 | * Now we need to make sure that target_dir is properly connected. | 147 | * Now we need to make sure that target_dir is properly connected. |
| 154 | * It may already be, as the flag isn't always updated when connection | 148 | * It may already be, as the flag isn't always updated when connection |
