Skip to content

Commit 30fe43e

Browse files
Al ViroKernel Patches Daemon
authored andcommitted
convert rpc_pipefs
Just use d_make_persistent() + dput() (and fold the latter into simple_finish_creating()) and that's it... NOTE: pipe->dentry is a borrowed reference - it does not contribute to dentry refcount. Signed-off-by: Al Viro <[email protected]>
1 parent 81e328a commit 30fe43e

File tree

1 file changed

+12
-15
lines changed

1 file changed

+12
-15
lines changed

net/sunrpc/rpc_pipe.c

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -536,17 +536,16 @@ static int rpc_new_file(struct dentry *parent,
536536

537537
inode = rpc_get_inode(dir->i_sb, S_IFREG | mode);
538538
if (unlikely(!inode)) {
539-
dput(dentry);
540-
inode_unlock(dir);
539+
simple_done_creating(dentry);
541540
return -ENOMEM;
542541
}
543542
inode->i_ino = iunique(dir->i_sb, 100);
544543
if (i_fop)
545544
inode->i_fop = i_fop;
546545
rpc_inode_setowner(inode, private);
547-
d_instantiate(dentry, inode);
546+
d_make_persistent(dentry, inode);
548547
fsnotify_create(dir, dentry);
549-
inode_unlock(dir);
548+
simple_done_creating(dentry);
550549
return 0;
551550
}
552551

@@ -563,18 +562,17 @@ static struct dentry *rpc_new_dir(struct dentry *parent,
563562

564563
inode = rpc_get_inode(dir->i_sb, S_IFDIR | mode);
565564
if (unlikely(!inode)) {
566-
dput(dentry);
567-
inode_unlock(dir);
565+
simple_done_creating(dentry);
568566
return ERR_PTR(-ENOMEM);
569567
}
570568

571569
inode->i_ino = iunique(dir->i_sb, 100);
572570
inc_nlink(dir);
573-
d_instantiate(dentry, inode);
571+
d_make_persistent(dentry, inode);
574572
fsnotify_mkdir(dir, dentry);
575-
inode_unlock(dir);
573+
simple_done_creating(dentry);
576574

577-
return dentry;
575+
return dentry; // borrowed
578576
}
579577

580578
static int rpc_populate(struct dentry *parent,
@@ -657,8 +655,7 @@ int rpc_mkpipe_dentry(struct dentry *parent, const char *name,
657655

658656
inode = rpc_get_inode(dir->i_sb, umode);
659657
if (unlikely(!inode)) {
660-
dput(dentry);
661-
inode_unlock(dir);
658+
simple_done_creating(dentry);
662659
err = -ENOMEM;
663660
goto failed;
664661
}
@@ -668,10 +665,10 @@ int rpc_mkpipe_dentry(struct dentry *parent, const char *name,
668665
rpci->private = private;
669666
rpci->pipe = pipe;
670667
rpc_inode_setowner(inode, private);
671-
d_instantiate(dentry, inode);
672-
pipe->dentry = dentry;
668+
pipe->dentry = dentry; // borrowed
669+
d_make_persistent(dentry, inode);
673670
fsnotify_create(dir, dentry);
674-
inode_unlock(dir);
671+
simple_done_creating(dentry);
675672
return 0;
676673

677674
failed:
@@ -1206,7 +1203,7 @@ static void rpc_kill_sb(struct super_block *sb)
12061203
sb);
12071204
mutex_unlock(&sn->pipefs_sb_lock);
12081205
out:
1209-
kill_litter_super(sb);
1206+
kill_anon_super(sb);
12101207
put_net(net);
12111208
}
12121209

0 commit comments

Comments
 (0)