Skip to content

Commit ea4cdc5

Browse files
Luis Henriquesidryomov
authored andcommitted
ceph: new mount option to disable usage of copy-from op
Add a new mount option 'nocopyfrom' that will prevent the usage of the RADOS 'copy-from' operation in cephfs. This could be useful, for example, for an administrator to temporarily mitigate any possible bugs in the 'copy-from' implementation. Currently, only copy_file_range uses this RADOS operation. Setting this mount option will result in this syscall reverting to the default VFS implementation, i.e. to perform the copies locally instead of doing remote object copies. Signed-off-by: Luis Henriques <lhenriques@suse.com> Reviewed-by: "Yan, Zheng" <zyan@redhat.com> Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
1 parent 503f82a commit ea4cdc5

File tree

4 files changed

+22
-0
lines changed

4 files changed

+22
-0
lines changed

Documentation/filesystems/ceph.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,11 @@ Mount Options
151151
Report overall filesystem usage in statfs instead of using the root
152152
directory quota.
153153

154+
nocopyfrom
155+
Don't use the RADOS 'copy-from' operation to perform remote object
156+
copies. Currently, it's only used in copy_file_range, which will revert
157+
to the default VFS implementation if this option is used.
158+
154159
More Information
155160
================
156161

fs/ceph/file.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1917,6 +1917,9 @@ static ssize_t ceph_copy_file_range(struct file *src_file, loff_t src_off,
19171917
* efficient).
19181918
*/
19191919

1920+
if (ceph_test_mount_opt(ceph_inode_to_client(src_inode), NOCOPYFROM))
1921+
return -EOPNOTSUPP;
1922+
19201923
if ((src_ci->i_layout.stripe_unit != dst_ci->i_layout.stripe_unit) ||
19211924
(src_ci->i_layout.stripe_count != dst_ci->i_layout.stripe_count) ||
19221925
(src_ci->i_layout.object_size != dst_ci->i_layout.object_size))

fs/ceph/super.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,8 @@ enum {
165165
Opt_noacl,
166166
Opt_quotadf,
167167
Opt_noquotadf,
168+
Opt_copyfrom,
169+
Opt_nocopyfrom,
168170
};
169171

170172
static match_table_t fsopt_tokens = {
@@ -203,6 +205,8 @@ static match_table_t fsopt_tokens = {
203205
{Opt_noacl, "noacl"},
204206
{Opt_quotadf, "quotadf"},
205207
{Opt_noquotadf, "noquotadf"},
208+
{Opt_copyfrom, "copyfrom"},
209+
{Opt_nocopyfrom, "nocopyfrom"},
206210
{-1, NULL}
207211
};
208212

@@ -355,6 +359,12 @@ static int parse_fsopt_token(char *c, void *private)
355359
case Opt_noquotadf:
356360
fsopt->flags |= CEPH_MOUNT_OPT_NOQUOTADF;
357361
break;
362+
case Opt_copyfrom:
363+
fsopt->flags &= ~CEPH_MOUNT_OPT_NOCOPYFROM;
364+
break;
365+
case Opt_nocopyfrom:
366+
fsopt->flags |= CEPH_MOUNT_OPT_NOCOPYFROM;
367+
break;
358368
#ifdef CONFIG_CEPH_FS_POSIX_ACL
359369
case Opt_acl:
360370
fsopt->sb_flags |= SB_POSIXACL;
@@ -553,6 +563,9 @@ static int ceph_show_options(struct seq_file *m, struct dentry *root)
553563
seq_puts(m, ",noacl");
554564
#endif
555565

566+
if (fsopt->flags & CEPH_MOUNT_OPT_NOCOPYFROM)
567+
seq_puts(m, ",nocopyfrom");
568+
556569
if (fsopt->mds_namespace)
557570
seq_show_option(m, "mds_namespace", fsopt->mds_namespace);
558571
if (fsopt->wsize != CEPH_MAX_WRITE_SIZE)

fs/ceph/super.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
#define CEPH_MOUNT_OPT_NOPOOLPERM (1<<11) /* no pool permission check */
4141
#define CEPH_MOUNT_OPT_MOUNTWAIT (1<<12) /* mount waits if no mds is up */
4242
#define CEPH_MOUNT_OPT_NOQUOTADF (1<<13) /* no root dir quota in statfs */
43+
#define CEPH_MOUNT_OPT_NOCOPYFROM (1<<14) /* don't use RADOS 'copy-from' op */
4344

4445
#define CEPH_MOUNT_OPT_DEFAULT CEPH_MOUNT_OPT_DCACHE
4546

0 commit comments

Comments
 (0)