Skip to content

Commit 752c8bd

Browse files
Sage WeilYan, Zheng
authored andcommitted
ceph: do not chain inode updates to parent fsync
The fsync(dirfd) only covers namespace operations, not inode updates. We do not need to cover setattr variants or O_TRUNC. Reported-by: Al Viro <viro@xeniv.linux.org.uk> Signed-off-by: Sage Weil <sage@inktank.com> Reviewed-by: Yan, Zheng <zheng.z.yan@intel.com>
1 parent 180061a commit 752c8bd

4 files changed

Lines changed: 5 additions & 17 deletions

File tree

‎fs/ceph/file.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ int ceph_open(struct inode *inode, struct file *file)
210210
ihold(inode);
211211

212212
req->r_num_caps = 1;
213-
if (flags & (O_CREAT|O_TRUNC))
213+
if (flags & O_CREAT)
214214
parent_inode = ceph_get_dentry_parent_inode(file->f_dentry);
215215
err = ceph_mdsc_do_request(mdsc, parent_inode, req);
216216
iput(parent_inode);

‎fs/ceph/inode.c‎

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1627,7 +1627,6 @@ int ceph_setattr(struct dentry *dentry, struct iattr *attr)
16271627
{
16281628
struct inode *inode = dentry->d_inode;
16291629
struct ceph_inode_info *ci = ceph_inode(inode);
1630-
struct inode *parent_inode;
16311630
const unsigned int ia_valid = attr->ia_valid;
16321631
struct ceph_mds_request *req;
16331632
struct ceph_mds_client *mdsc = ceph_sb_to_client(dentry->d_sb)->mdsc;
@@ -1819,9 +1818,7 @@ int ceph_setattr(struct dentry *dentry, struct iattr *attr)
18191818
req->r_inode_drop = release;
18201819
req->r_args.setattr.mask = cpu_to_le32(mask);
18211820
req->r_num_caps = 1;
1822-
parent_inode = ceph_get_dentry_parent_inode(dentry);
1823-
err = ceph_mdsc_do_request(mdsc, parent_inode, req);
1824-
iput(parent_inode);
1821+
err = ceph_mdsc_do_request(mdsc, NULL, req);
18251822
}
18261823
dout("setattr %p result=%d (%s locally, %d remote)\n", inode, err,
18271824
ceph_cap_string(dirtied), mask);

‎fs/ceph/ioctl.c‎

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@ static long __validate_layout(struct ceph_mds_client *mdsc,
6464
static long ceph_ioctl_set_layout(struct file *file, void __user *arg)
6565
{
6666
struct inode *inode = file_inode(file);
67-
struct inode *parent_inode;
6867
struct ceph_mds_client *mdsc = ceph_sb_to_client(inode->i_sb)->mdsc;
6968
struct ceph_mds_request *req;
7069
struct ceph_ioctl_layout l;
@@ -121,9 +120,7 @@ static long ceph_ioctl_set_layout(struct file *file, void __user *arg)
121120
cpu_to_le32(l.object_size);
122121
req->r_args.setlayout.layout.fl_pg_pool = cpu_to_le32(l.data_pool);
123122

124-
parent_inode = ceph_get_dentry_parent_inode(file->f_dentry);
125-
err = ceph_mdsc_do_request(mdsc, parent_inode, req);
126-
iput(parent_inode);
123+
err = ceph_mdsc_do_request(mdsc, NULL, req);
127124
ceph_mdsc_put_request(req);
128125
return err;
129126
}

‎fs/ceph/xattr.c‎

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -842,7 +842,6 @@ static int ceph_sync_setxattr(struct dentry *dentry, const char *name,
842842
struct ceph_fs_client *fsc = ceph_sb_to_client(dentry->d_sb);
843843
struct inode *inode = dentry->d_inode;
844844
struct ceph_inode_info *ci = ceph_inode(inode);
845-
struct inode *parent_inode;
846845
struct ceph_mds_request *req;
847846
struct ceph_mds_client *mdsc = fsc->mdsc;
848847
int err;
@@ -893,9 +892,7 @@ static int ceph_sync_setxattr(struct dentry *dentry, const char *name,
893892
req->r_data_len = size;
894893

895894
dout("xattr.ver (before): %lld\n", ci->i_xattrs.version);
896-
parent_inode = ceph_get_dentry_parent_inode(dentry);
897-
err = ceph_mdsc_do_request(mdsc, parent_inode, req);
898-
iput(parent_inode);
895+
err = ceph_mdsc_do_request(mdsc, NULL, req);
899896
ceph_mdsc_put_request(req);
900897
dout("xattr.ver (after): %lld\n", ci->i_xattrs.version);
901898

@@ -1019,7 +1016,6 @@ static int ceph_send_removexattr(struct dentry *dentry, const char *name)
10191016
struct ceph_fs_client *fsc = ceph_sb_to_client(dentry->d_sb);
10201017
struct ceph_mds_client *mdsc = fsc->mdsc;
10211018
struct inode *inode = dentry->d_inode;
1022-
struct inode *parent_inode;
10231019
struct ceph_mds_request *req;
10241020
int err;
10251021

@@ -1033,9 +1029,7 @@ static int ceph_send_removexattr(struct dentry *dentry, const char *name)
10331029
req->r_num_caps = 1;
10341030
req->r_path2 = kstrdup(name, GFP_NOFS);
10351031

1036-
parent_inode = ceph_get_dentry_parent_inode(dentry);
1037-
err = ceph_mdsc_do_request(mdsc, parent_inode, req);
1038-
iput(parent_inode);
1032+
err = ceph_mdsc_do_request(mdsc, NULL, req);
10391033
ceph_mdsc_put_request(req);
10401034
return err;
10411035
}

0 commit comments

Comments
 (0)