Skip to content

Commit 6ceac38

Browse files
jtlaytongregkh
authored andcommitted
ceph: set pool_ns in new inode layout for async creates
commit 4584a76 upstream. Dan reported that he was unable to write to files that had been asynchronously created when the client's OSD caps are restricted to a particular namespace. The issue is that the layout for the new inode is only partially being filled. Ensure that we populate the pool_ns_data and pool_ns_len in the iinfo before calling ceph_fill_inode. Cc: stable@vger.kernel.org URL: https://tracker.ceph.com/issues/54013 Fixes: 9a8d03c ("ceph: attempt to do async create when possible") Reported-by: Dan van der Ster <dan@vanderster.com> Signed-off-by: Jeff Layton <jlayton@kernel.org> Reviewed-by: Ilya Dryomov <idryomov@gmail.com> Signed-off-by: Ilya Dryomov <idryomov@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent e7be12c commit 6ceac38

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

‎fs/ceph/file.c‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -577,6 +577,7 @@ static int ceph_finish_async_create(struct inode *dir, struct dentry *dentry,
577577
struct ceph_inode_info *ci = ceph_inode(dir);
578578
struct inode *inode;
579579
struct timespec64 now;
580+
struct ceph_string *pool_ns;
580581
struct ceph_mds_client *mdsc = ceph_sb_to_mdsc(dir->i_sb);
581582
struct ceph_vino vino = { .ino = req->r_deleg_ino,
582583
.snap = CEPH_NOSNAP };
@@ -626,6 +627,12 @@ static int ceph_finish_async_create(struct inode *dir, struct dentry *dentry,
626627
in.max_size = cpu_to_le64(lo->stripe_unit);
627628

628629
ceph_file_layout_to_legacy(lo, &in.layout);
630+
/* lo is private, so pool_ns can't change */
631+
pool_ns = rcu_dereference_raw(lo->pool_ns);
632+
if (pool_ns) {
633+
iinfo.pool_ns_len = pool_ns->len;
634+
iinfo.pool_ns_data = pool_ns->str;
635+
}
629636

630637
down_read(&mdsc->snap_rwsem);
631638
ret = ceph_fill_inode(inode, NULL, &iinfo, NULL, req->r_session,

0 commit comments

Comments
 (0)