diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2014-10-15 00:46:01 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2014-10-15 00:46:01 -0400 |
commit | 6b0490816671b2f4126a99998c9bf3c8c0472de2 (patch) | |
tree | 016543455c2bdbe47b422fed6a3b4ffb991c97d6 /fs/ceph/dir.c | |
parent | ce9d7f7b45930ed16c512aabcfe651d44f1c8619 (diff) | |
parent | 0bc62284ee3f2a228c64902ed818b6ba8e04159b (diff) |
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/sage/ceph-client
Pull Ceph updates from Sage Weil:
"There is the long-awaited discard support for RBD (Guangliang Zhao,
Josh Durgin), a pile of RBD bug fixes that didn't belong in late -rc's
(Ilya Dryomov, Li RongQing), a pile of fs/ceph bug fixes and
performance and debugging improvements (Yan, Zheng, John Spray), and a
smattering of cleanups (Chao Yu, Fabian Frederick, Joe Perches)"
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/sage/ceph-client: (40 commits)
ceph: fix divide-by-zero in __validate_layout()
rbd: rbd workqueues need a resque worker
libceph: ceph-msgr workqueue needs a resque worker
ceph: fix bool assignments
libceph: separate multiple ops with commas in debugfs output
libceph: sync osd op definitions in rados.h
libceph: remove redundant declaration
ceph: additional debugfs output
ceph: export ceph_session_state_name function
ceph: include the initial ACL in create/mkdir/mknod MDS requests
ceph: use pagelist to present MDS request data
libceph: reference counting pagelist
ceph: fix llistxattr on symlink
ceph: send client metadata to MDS
ceph: remove redundant code for max file size verification
ceph: remove redundant io_iter_advance()
ceph: move ceph_find_inode() outside the s_mutex
ceph: request xattrs if xattr_version is zero
rbd: set the remaining discard properties to enable support
rbd: use helpers to handle discard for layered images correctly
...
Diffstat (limited to 'fs/ceph/dir.c')
-rw-r--r-- | fs/ceph/dir.c | 41 |
1 files changed, 31 insertions, 10 deletions
diff --git a/fs/ceph/dir.c b/fs/ceph/dir.c index b6c59eaa4f64..e6d63f8f98c0 100644 --- a/fs/ceph/dir.c +++ b/fs/ceph/dir.c | |||
@@ -682,17 +682,22 @@ static int ceph_mknod(struct inode *dir, struct dentry *dentry, | |||
682 | struct ceph_fs_client *fsc = ceph_sb_to_client(dir->i_sb); | 682 | struct ceph_fs_client *fsc = ceph_sb_to_client(dir->i_sb); |
683 | struct ceph_mds_client *mdsc = fsc->mdsc; | 683 | struct ceph_mds_client *mdsc = fsc->mdsc; |
684 | struct ceph_mds_request *req; | 684 | struct ceph_mds_request *req; |
685 | struct ceph_acls_info acls = {}; | ||
685 | int err; | 686 | int err; |
686 | 687 | ||
687 | if (ceph_snap(dir) != CEPH_NOSNAP) | 688 | if (ceph_snap(dir) != CEPH_NOSNAP) |
688 | return -EROFS; | 689 | return -EROFS; |
689 | 690 | ||
691 | err = ceph_pre_init_acls(dir, &mode, &acls); | ||
692 | if (err < 0) | ||
693 | return err; | ||
694 | |||
690 | dout("mknod in dir %p dentry %p mode 0%ho rdev %d\n", | 695 | dout("mknod in dir %p dentry %p mode 0%ho rdev %d\n", |
691 | dir, dentry, mode, rdev); | 696 | dir, dentry, mode, rdev); |
692 | req = ceph_mdsc_create_request(mdsc, CEPH_MDS_OP_MKNOD, USE_AUTH_MDS); | 697 | req = ceph_mdsc_create_request(mdsc, CEPH_MDS_OP_MKNOD, USE_AUTH_MDS); |
693 | if (IS_ERR(req)) { | 698 | if (IS_ERR(req)) { |
694 | d_drop(dentry); | 699 | err = PTR_ERR(req); |
695 | return PTR_ERR(req); | 700 | goto out; |
696 | } | 701 | } |
697 | req->r_dentry = dget(dentry); | 702 | req->r_dentry = dget(dentry); |
698 | req->r_num_caps = 2; | 703 | req->r_num_caps = 2; |
@@ -701,15 +706,20 @@ static int ceph_mknod(struct inode *dir, struct dentry *dentry, | |||
701 | req->r_args.mknod.rdev = cpu_to_le32(rdev); | 706 | req->r_args.mknod.rdev = cpu_to_le32(rdev); |
702 | req->r_dentry_drop = CEPH_CAP_FILE_SHARED; | 707 | req->r_dentry_drop = CEPH_CAP_FILE_SHARED; |
703 | req->r_dentry_unless = CEPH_CAP_FILE_EXCL; | 708 | req->r_dentry_unless = CEPH_CAP_FILE_EXCL; |
709 | if (acls.pagelist) { | ||
710 | req->r_pagelist = acls.pagelist; | ||
711 | acls.pagelist = NULL; | ||
712 | } | ||
704 | err = ceph_mdsc_do_request(mdsc, dir, req); | 713 | err = ceph_mdsc_do_request(mdsc, dir, req); |
705 | if (!err && !req->r_reply_info.head->is_dentry) | 714 | if (!err && !req->r_reply_info.head->is_dentry) |
706 | err = ceph_handle_notrace_create(dir, dentry); | 715 | err = ceph_handle_notrace_create(dir, dentry); |
707 | ceph_mdsc_put_request(req); | 716 | ceph_mdsc_put_request(req); |
708 | 717 | out: | |
709 | if (!err) | 718 | if (!err) |
710 | ceph_init_acl(dentry, dentry->d_inode, dir); | 719 | ceph_init_inode_acls(dentry->d_inode, &acls); |
711 | else | 720 | else |
712 | d_drop(dentry); | 721 | d_drop(dentry); |
722 | ceph_release_acls_info(&acls); | ||
713 | return err; | 723 | return err; |
714 | } | 724 | } |
715 | 725 | ||
@@ -733,8 +743,8 @@ static int ceph_symlink(struct inode *dir, struct dentry *dentry, | |||
733 | dout("symlink in dir %p dentry %p to '%s'\n", dir, dentry, dest); | 743 | dout("symlink in dir %p dentry %p to '%s'\n", dir, dentry, dest); |
734 | req = ceph_mdsc_create_request(mdsc, CEPH_MDS_OP_SYMLINK, USE_AUTH_MDS); | 744 | req = ceph_mdsc_create_request(mdsc, CEPH_MDS_OP_SYMLINK, USE_AUTH_MDS); |
735 | if (IS_ERR(req)) { | 745 | if (IS_ERR(req)) { |
736 | d_drop(dentry); | 746 | err = PTR_ERR(req); |
737 | return PTR_ERR(req); | 747 | goto out; |
738 | } | 748 | } |
739 | req->r_dentry = dget(dentry); | 749 | req->r_dentry = dget(dentry); |
740 | req->r_num_caps = 2; | 750 | req->r_num_caps = 2; |
@@ -746,9 +756,8 @@ static int ceph_symlink(struct inode *dir, struct dentry *dentry, | |||
746 | if (!err && !req->r_reply_info.head->is_dentry) | 756 | if (!err && !req->r_reply_info.head->is_dentry) |
747 | err = ceph_handle_notrace_create(dir, dentry); | 757 | err = ceph_handle_notrace_create(dir, dentry); |
748 | ceph_mdsc_put_request(req); | 758 | ceph_mdsc_put_request(req); |
749 | if (!err) | 759 | out: |
750 | ceph_init_acl(dentry, dentry->d_inode, dir); | 760 | if (err) |
751 | else | ||
752 | d_drop(dentry); | 761 | d_drop(dentry); |
753 | return err; | 762 | return err; |
754 | } | 763 | } |
@@ -758,6 +767,7 @@ static int ceph_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode) | |||
758 | struct ceph_fs_client *fsc = ceph_sb_to_client(dir->i_sb); | 767 | struct ceph_fs_client *fsc = ceph_sb_to_client(dir->i_sb); |
759 | struct ceph_mds_client *mdsc = fsc->mdsc; | 768 | struct ceph_mds_client *mdsc = fsc->mdsc; |
760 | struct ceph_mds_request *req; | 769 | struct ceph_mds_request *req; |
770 | struct ceph_acls_info acls = {}; | ||
761 | int err = -EROFS; | 771 | int err = -EROFS; |
762 | int op; | 772 | int op; |
763 | 773 | ||
@@ -772,6 +782,12 @@ static int ceph_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode) | |||
772 | } else { | 782 | } else { |
773 | goto out; | 783 | goto out; |
774 | } | 784 | } |
785 | |||
786 | mode |= S_IFDIR; | ||
787 | err = ceph_pre_init_acls(dir, &mode, &acls); | ||
788 | if (err < 0) | ||
789 | goto out; | ||
790 | |||
775 | req = ceph_mdsc_create_request(mdsc, op, USE_AUTH_MDS); | 791 | req = ceph_mdsc_create_request(mdsc, op, USE_AUTH_MDS); |
776 | if (IS_ERR(req)) { | 792 | if (IS_ERR(req)) { |
777 | err = PTR_ERR(req); | 793 | err = PTR_ERR(req); |
@@ -784,15 +800,20 @@ static int ceph_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode) | |||
784 | req->r_args.mkdir.mode = cpu_to_le32(mode); | 800 | req->r_args.mkdir.mode = cpu_to_le32(mode); |
785 | req->r_dentry_drop = CEPH_CAP_FILE_SHARED; | 801 | req->r_dentry_drop = CEPH_CAP_FILE_SHARED; |
786 | req->r_dentry_unless = CEPH_CAP_FILE_EXCL; | 802 | req->r_dentry_unless = CEPH_CAP_FILE_EXCL; |
803 | if (acls.pagelist) { | ||
804 | req->r_pagelist = acls.pagelist; | ||
805 | acls.pagelist = NULL; | ||
806 | } | ||
787 | err = ceph_mdsc_do_request(mdsc, dir, req); | 807 | err = ceph_mdsc_do_request(mdsc, dir, req); |
788 | if (!err && !req->r_reply_info.head->is_dentry) | 808 | if (!err && !req->r_reply_info.head->is_dentry) |
789 | err = ceph_handle_notrace_create(dir, dentry); | 809 | err = ceph_handle_notrace_create(dir, dentry); |
790 | ceph_mdsc_put_request(req); | 810 | ceph_mdsc_put_request(req); |
791 | out: | 811 | out: |
792 | if (!err) | 812 | if (!err) |
793 | ceph_init_acl(dentry, dentry->d_inode, dir); | 813 | ceph_init_inode_acls(dentry->d_inode, &acls); |
794 | else | 814 | else |
795 | d_drop(dentry); | 815 | d_drop(dentry); |
816 | ceph_release_acls_info(&acls); | ||
796 | return err; | 817 | return err; |
797 | } | 818 | } |
798 | 819 | ||