Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

rpc_mkpipe_dentry(): switch to simple_start_creating()

... and make sure we set the fs-private part of inode up before
attaching it to dentry.

Reviewed-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>

Al Viro a117bf4c 5c1da758

+29 -54
+29 -54
net/sunrpc/rpc_pipe.c
··· 485 485 return inode; 486 486 } 487 487 488 - static int __rpc_create_common(struct inode *dir, struct dentry *dentry, 489 - umode_t mode, 490 - const struct file_operations *i_fop, 491 - void *private) 492 - { 493 - struct inode *inode; 494 - 495 - d_drop(dentry); 496 - inode = rpc_get_inode(dir->i_sb, mode); 497 - if (!inode) 498 - goto out_err; 499 - inode->i_ino = iunique(dir->i_sb, 100); 500 - if (i_fop) 501 - inode->i_fop = i_fop; 502 - if (private) 503 - rpc_inode_setowner(inode, private); 504 - d_add(dentry, inode); 505 - return 0; 506 - out_err: 507 - printk(KERN_WARNING "%s: %s failed to allocate inode for dentry %pd\n", 508 - __FILE__, __func__, dentry); 509 - dput(dentry); 510 - return -ENOMEM; 511 - } 512 - 513 488 static void 514 489 init_pipe(struct rpc_pipe *pipe) 515 490 { ··· 520 545 return pipe; 521 546 } 522 547 EXPORT_SYMBOL_GPL(rpc_mkpipe_data); 523 - 524 - static int __rpc_mkpipe_dentry(struct inode *dir, struct dentry *dentry, 525 - umode_t mode, 526 - const struct file_operations *i_fop, 527 - void *private, 528 - struct rpc_pipe *pipe) 529 - { 530 - struct rpc_inode *rpci; 531 - int err; 532 - 533 - err = __rpc_create_common(dir, dentry, S_IFIFO | mode, i_fop, private); 534 - if (err) 535 - return err; 536 - rpci = RPC_I(d_inode(dentry)); 537 - rpci->private = private; 538 - rpci->pipe = pipe; 539 - fsnotify_create(dir, dentry); 540 - return 0; 541 - } 542 548 543 549 static int rpc_new_file(struct dentry *parent, 544 550 const char *name, ··· 660 704 int rpc_mkpipe_dentry(struct dentry *parent, const char *name, 661 705 void *private, struct rpc_pipe *pipe) 662 706 { 663 - struct dentry *dentry; 664 707 struct inode *dir = d_inode(parent); 708 + struct dentry *dentry; 709 + struct inode *inode; 710 + struct rpc_inode *rpci; 665 711 umode_t umode = S_IFIFO | 0600; 666 712 int err; 667 713 ··· 673 715 umode &= ~0222; 674 716 675 717 dentry = simple_start_creating(parent, name); 676 - if (IS_ERR(dentry)) 677 - return PTR_ERR(dentry); 678 - err = __rpc_mkpipe_dentry(dir, dentry, umode, &rpc_pipe_fops, 679 - private, pipe); 680 - if (unlikely(err)) 681 - pr_warn("%s() failed to create pipe %pd/%s (errno = %d)\n", 682 - __func__, parent, name, err); 683 - else 684 - pipe->dentry = dentry; 718 + if (IS_ERR(dentry)) { 719 + err = PTR_ERR(dentry); 720 + goto failed; 721 + } 722 + 723 + inode = rpc_get_inode(dir->i_sb, umode); 724 + if (unlikely(!inode)) { 725 + dput(dentry); 726 + inode_unlock(dir); 727 + err = -ENOMEM; 728 + goto failed; 729 + } 730 + inode->i_ino = iunique(dir->i_sb, 100); 731 + inode->i_fop = &rpc_pipe_fops; 732 + rpci = RPC_I(inode); 733 + rpci->private = private; 734 + rpci->pipe = pipe; 735 + rpc_inode_setowner(inode, private); 736 + d_instantiate(dentry, inode); 737 + pipe->dentry = dentry; 738 + fsnotify_create(dir, dentry); 685 739 inode_unlock(dir); 740 + return 0; 741 + 742 + failed: 743 + pr_warn("%s() failed to create pipe %pd/%s (errno = %d)\n", 744 + __func__, parent, name, err); 686 745 return err; 687 746 } 688 747 EXPORT_SYMBOL_GPL(rpc_mkpipe_dentry);