Skip to content

Commit 4889269

Browse files
committed
Merge tag 'pull-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
Pull misc filesystem updates from Al Viro: "Misc cleanups (the part that hadn't been picked by individual fs trees)" * tag 'pull-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: apparmorfs: don't duplicate kfree_link() orangefs: saner arguments passing in readdir guts ocfs2_find_match(): there's no such thing as NULL or negative ->d_parent reiserfs_add_entry(): get rid of pointless namelen checks __ocfs2_add_entry(), ocfs2_prepare_dir_for_insert(): namelen checks ext4_add_entry(): ->d_name.len is never 0 befs: d_obtain_alias(ERR_PTR(...)) will do the right thing affs: d_obtain_alias(ERR_PTR(...)) will do the right thing /proc/sys: use d_splice_alias() calling conventions to simplify failure exits hostfs: use d_splice_alias() calling conventions to simplify failure exits udf_fiiter_add_entry(): check for zero ->d_name.len is bogus... udf: d_obtain_alias(ERR_PTR(...)) will do the right thing... udf: d_splice_alias() will do the right thing on ERR_PTR() inode nfsd: kill stale comment about simple_fill_super() requirements bfs_add_entry(): get rid of pointless ->d_name.len checks nilfs2: d_obtain_alias(ERR_PTR(...)) will do the right thing... zonefs: d_splice_alias() will do the right thing on ERR_PTR() inode
2 parents 499aa1c + c5f3fd2 commit 4889269

File tree

15 files changed

+19
-102
lines changed

15 files changed

+19
-102
lines changed

fs/affs/namei.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -532,9 +532,6 @@ static struct dentry *affs_get_parent(struct dentry *child)
532532
parent = affs_iget(child->d_sb,
533533
be32_to_cpu(AFFS_TAIL(child->d_sb, bh)->parent));
534534
brelse(bh);
535-
if (IS_ERR(parent))
536-
return ERR_CAST(parent);
537-
538535
return d_obtain_alias(parent);
539536
}
540537

fs/befs/linuxvfs.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -671,9 +671,6 @@ static struct dentry *befs_get_parent(struct dentry *child)
671671

672672
parent = befs_iget(child->d_sb,
673673
(unsigned long)befs_ino->i_parent.start);
674-
if (IS_ERR(parent))
675-
return ERR_CAST(parent);
676-
677674
return d_obtain_alias(parent);
678675
}
679676

fs/bfs/dir.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -275,11 +275,6 @@ static int bfs_add_entry(struct inode *dir, const struct qstr *child, int ino)
275275

276276
dprintf("name=%s, namelen=%d\n", name, namelen);
277277

278-
if (!namelen)
279-
return -ENOENT;
280-
if (namelen > BFS_NAMELEN)
281-
return -ENAMETOOLONG;
282-
283278
sblock = BFS_I(dir)->i_sblock;
284279
eblock = BFS_I(dir)->i_eblock;
285280
for (block = sblock; block <= eblock; block++) {

fs/ext4/namei.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2388,8 +2388,6 @@ static int ext4_add_entry(handle_t *handle, struct dentry *dentry,
23882388

23892389
sb = dir->i_sb;
23902390
blocksize = sb->s_blocksize;
2391-
if (!dentry->d_name.len)
2392-
return -EINVAL;
23932391

23942392
if (fscrypt_is_nokey_name(dentry))
23952393
return -ENOKEY;

fs/hostfs/hostfs_kern.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -637,12 +637,8 @@ static struct dentry *hostfs_lookup(struct inode *ino, struct dentry *dentry,
637637

638638
inode = hostfs_iget(ino->i_sb, name);
639639
__putname(name);
640-
if (IS_ERR(inode)) {
641-
if (PTR_ERR(inode) == -ENOENT)
642-
inode = NULL;
643-
else
644-
return ERR_CAST(inode);
645-
}
640+
if (inode == ERR_PTR(-ENOENT))
641+
inode = NULL;
646642

647643
return d_splice_alias(inode, dentry);
648644
}

fs/nfsd/nfsctl.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,6 @@ enum {
4848
NFSD_MaxBlkSize,
4949
NFSD_MaxConnections,
5050
NFSD_Filecache,
51-
/*
52-
* The below MUST come last. Otherwise we leave a hole in nfsd_files[]
53-
* with !CONFIG_NFSD_V4 and simple_fill_super() goes oops
54-
*/
5551
#ifdef CONFIG_NFSD_V4
5652
NFSD_Leasetime,
5753
NFSD_Gracetime,

fs/nilfs2/namei.c

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -441,7 +441,6 @@ static int nilfs_rename(struct mnt_idmap *idmap,
441441
static struct dentry *nilfs_get_parent(struct dentry *child)
442442
{
443443
unsigned long ino;
444-
struct inode *inode;
445444
struct nilfs_root *root;
446445

447446
ino = nilfs_inode_by_name(d_inode(child), &dotdot_name);
@@ -450,11 +449,7 @@ static struct dentry *nilfs_get_parent(struct dentry *child)
450449

451450
root = NILFS_I(d_inode(child))->i_root;
452451

453-
inode = nilfs_iget(child->d_sb, root, ino);
454-
if (IS_ERR(inode))
455-
return ERR_CAST(inode);
456-
457-
return d_obtain_alias(inode);
452+
return d_obtain_alias(nilfs_iget(child->d_sb, root, ino));
458453
}
459454

460455
static struct dentry *nilfs_get_dentry(struct super_block *sb, u64 cno,

fs/ocfs2/dcache.c

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -124,17 +124,10 @@ static int ocfs2_match_dentry(struct dentry *dentry,
124124
if (!dentry->d_fsdata)
125125
return 0;
126126

127-
if (!dentry->d_parent)
128-
return 0;
129-
130127
if (skip_unhashed && d_unhashed(dentry))
131128
return 0;
132129

133130
parent = d_inode(dentry->d_parent);
134-
/* Negative parent dentry? */
135-
if (!parent)
136-
return 0;
137-
138131
/* Name is in a different directory. */
139132
if (OCFS2_I(parent)->ip_blkno != parent_blkno)
140133
return 0;

fs/ocfs2/dir.c

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1593,9 +1593,6 @@ int __ocfs2_add_entry(handle_t *handle,
15931593
struct buffer_head *insert_bh = lookup->dl_leaf_bh;
15941594
char *data_start = insert_bh->b_data;
15951595

1596-
if (!namelen)
1597-
return -EINVAL;
1598-
15991596
if (ocfs2_dir_indexed(dir)) {
16001597
struct buffer_head *bh;
16011598

@@ -4245,12 +4242,6 @@ int ocfs2_prepare_dir_for_insert(struct ocfs2_super *osb,
42454242
trace_ocfs2_prepare_dir_for_insert(
42464243
(unsigned long long)OCFS2_I(dir)->ip_blkno, namelen);
42474244

4248-
if (!namelen) {
4249-
ret = -EINVAL;
4250-
mlog_errno(ret);
4251-
goto out;
4252-
}
4253-
42544245
/*
42554246
* Do this up front to reduce confusion.
42564247
*

fs/orangefs/dir.c

Lines changed: 12 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,10 @@ struct orangefs_dir {
5858
* first part of the part list.
5959
*/
6060

61-
static int do_readdir(struct orangefs_inode_s *oi,
62-
struct orangefs_dir *od, struct dentry *dentry,
61+
static int do_readdir(struct orangefs_dir *od, struct inode *inode,
6362
struct orangefs_kernel_op_s *op)
6463
{
64+
struct orangefs_inode_s *oi = ORANGEFS_I(inode);
6565
struct orangefs_readdir_response_s *resp;
6666
int bufi, r;
6767

@@ -87,7 +87,7 @@ static int do_readdir(struct orangefs_inode_s *oi,
8787
op->upcall.req.readdir.buf_index = bufi;
8888

8989
r = service_operation(op, "orangefs_readdir",
90-
get_interruptible_flag(dentry->d_inode));
90+
get_interruptible_flag(inode));
9191

9292
orangefs_readdir_index_put(bufi);
9393

@@ -158,8 +158,7 @@ static int parse_readdir(struct orangefs_dir *od,
158158
return 0;
159159
}
160160

161-
static int orangefs_dir_more(struct orangefs_inode_s *oi,
162-
struct orangefs_dir *od, struct dentry *dentry)
161+
static int orangefs_dir_more(struct orangefs_dir *od, struct inode *inode)
163162
{
164163
struct orangefs_kernel_op_s *op;
165164
int r;
@@ -169,7 +168,7 @@ static int orangefs_dir_more(struct orangefs_inode_s *oi,
169168
od->error = -ENOMEM;
170169
return -ENOMEM;
171170
}
172-
r = do_readdir(oi, od, dentry, op);
171+
r = do_readdir(od, inode, op);
173172
if (r) {
174173
od->error = r;
175174
goto out;
@@ -238,9 +237,7 @@ static int fill_from_part(struct orangefs_dir_part *part,
238237
return 1;
239238
}
240239

241-
static int orangefs_dir_fill(struct orangefs_inode_s *oi,
242-
struct orangefs_dir *od, struct dentry *dentry,
243-
struct dir_context *ctx)
240+
static int orangefs_dir_fill(struct orangefs_dir *od, struct dir_context *ctx)
244241
{
245242
struct orangefs_dir_part *part;
246243
size_t count;
@@ -304,15 +301,10 @@ static loff_t orangefs_dir_llseek(struct file *file, loff_t offset,
304301
static int orangefs_dir_iterate(struct file *file,
305302
struct dir_context *ctx)
306303
{
307-
struct orangefs_inode_s *oi;
308-
struct orangefs_dir *od;
309-
struct dentry *dentry;
304+
struct orangefs_dir *od = file->private_data;
305+
struct inode *inode = file_inode(file);
310306
int r;
311307

312-
dentry = file->f_path.dentry;
313-
oi = ORANGEFS_I(dentry->d_inode);
314-
od = file->private_data;
315-
316308
if (od->error)
317309
return od->error;
318310

@@ -342,7 +334,7 @@ static int orangefs_dir_iterate(struct file *file,
342334
*/
343335
while (od->token != ORANGEFS_ITERATE_END &&
344336
ctx->pos > od->end) {
345-
r = orangefs_dir_more(oi, od, dentry);
337+
r = orangefs_dir_more(od, inode);
346338
if (r)
347339
return r;
348340
}
@@ -351,17 +343,17 @@ static int orangefs_dir_iterate(struct file *file,
351343

352344
/* Then try to fill if there's any left in the buffer. */
353345
if (ctx->pos < od->end) {
354-
r = orangefs_dir_fill(oi, od, dentry, ctx);
346+
r = orangefs_dir_fill(od, ctx);
355347
if (r)
356348
return r;
357349
}
358350

359351
/* Finally get some more and try to fill. */
360352
if (od->token != ORANGEFS_ITERATE_END) {
361-
r = orangefs_dir_more(oi, od, dentry);
353+
r = orangefs_dir_more(od, inode);
362354
if (r)
363355
return r;
364-
r = orangefs_dir_fill(oi, od, dentry, ctx);
356+
r = orangefs_dir_fill(od, ctx);
365357
}
366358

367359
return r;

0 commit comments

Comments
 (0)