Skip to content

Commit

Permalink
ceph: set pool_ns in new inode layout for async creates
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
jtlayton authored and idryomov committed Jan 26, 2022
1 parent 932a9b5 commit 4584a76
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions fs/ceph/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -583,6 +583,7 @@ static int ceph_finish_async_create(struct inode *dir, struct dentry *dentry,
struct ceph_inode_info *ci = ceph_inode(dir);
struct inode *inode;
struct timespec64 now;
struct ceph_string *pool_ns;
struct ceph_mds_client *mdsc = ceph_sb_to_mdsc(dir->i_sb);
struct ceph_vino vino = { .ino = req->r_deleg_ino,
.snap = CEPH_NOSNAP };
Expand Down Expand Up @@ -632,6 +633,12 @@ static int ceph_finish_async_create(struct inode *dir, struct dentry *dentry,
in.max_size = cpu_to_le64(lo->stripe_unit);

ceph_file_layout_to_legacy(lo, &in.layout);
/* lo is private, so pool_ns can't change */
pool_ns = rcu_dereference_raw(lo->pool_ns);
if (pool_ns) {
iinfo.pool_ns_len = pool_ns->len;
iinfo.pool_ns_data = pool_ns->str;
}

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

0 comments on commit 4584a76

Please sign in to comment.