Skip to content

Commit 4584a76

Browse files
jtlaytonidryomov
authored andcommitted
ceph: set pool_ns in new inode layout for async creates
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: [email protected] URL: https://tracker.ceph.com/issues/54013 Fixes: 9a8d03c ("ceph: attempt to do async create when possible") Reported-by: Dan van der Ster <[email protected]> Signed-off-by: Jeff Layton <[email protected]> Reviewed-by: Ilya Dryomov <[email protected]> Signed-off-by: Ilya Dryomov <[email protected]>
1 parent 932a9b5 commit 4584a76

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

fs/ceph/file.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -583,6 +583,7 @@ static int ceph_finish_async_create(struct inode *dir, struct dentry *dentry,
583583
struct ceph_inode_info *ci = ceph_inode(dir);
584584
struct inode *inode;
585585
struct timespec64 now;
586+
struct ceph_string *pool_ns;
586587
struct ceph_mds_client *mdsc = ceph_sb_to_mdsc(dir->i_sb);
587588
struct ceph_vino vino = { .ino = req->r_deleg_ino,
588589
.snap = CEPH_NOSNAP };
@@ -632,6 +633,12 @@ static int ceph_finish_async_create(struct inode *dir, struct dentry *dentry,
632633
in.max_size = cpu_to_le64(lo->stripe_unit);
633634

634635
ceph_file_layout_to_legacy(lo, &in.layout);
636+
/* lo is private, so pool_ns can't change */
637+
pool_ns = rcu_dereference_raw(lo->pool_ns);
638+
if (pool_ns) {
639+
iinfo.pool_ns_len = pool_ns->len;
640+
iinfo.pool_ns_data = pool_ns->str;
641+
}
635642

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

0 commit comments

Comments
 (0)