diff options
author | Chunwei Chen <[email protected]> | 2016-10-19 11:19:01 -0700 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2016-10-20 09:39:09 -0700 |
commit | b8d9e26440ade0edebfa98af8cb9371810c1aeaf (patch) | |
tree | dd7131c9a6ed12367a4109568c7070ab8ebe89e2 /module/zfs | |
parent | 8ba3f2bf6a66378b36acd70e5616a78396030984 (diff) |
Linux 4.9 compat: iops->rename() wants flags
In Linux 4.9, torvalds/linux@2773bf0, iops->rename() and iops->rename2() are
merged together into iops->rename(), it now wants flags.
Signed-off-by: Chunwei Chen <[email protected]>
Diffstat (limited to 'module/zfs')
-rw-r--r-- | module/zfs/zpl_ctldir.c | 23 | ||||
-rw-r--r-- | module/zfs/zpl_inode.c | 21 |
2 files changed, 39 insertions, 5 deletions
diff --git a/module/zfs/zpl_ctldir.c b/module/zfs/zpl_ctldir.c index 7c4fcea3e..cdd6668b1 100644 --- a/module/zfs/zpl_ctldir.c +++ b/module/zfs/zpl_ctldir.c @@ -301,13 +301,17 @@ zpl_snapdir_readdir(struct file *filp, void *dirent, filldir_t filldir) } #endif /* HAVE_VFS_ITERATE */ -int -zpl_snapdir_rename(struct inode *sdip, struct dentry *sdentry, - struct inode *tdip, struct dentry *tdentry) +static int +zpl_snapdir_rename2(struct inode *sdip, struct dentry *sdentry, + struct inode *tdip, struct dentry *tdentry, unsigned int flags) { cred_t *cr = CRED(); int error; + /* We probably don't want to support renameat2(2) in ctldir */ + if (flags) + return (-EINVAL); + crhold(cr); error = -zfsctl_snapdir_rename(sdip, dname(sdentry), tdip, dname(tdentry), cr, 0); @@ -317,6 +321,15 @@ zpl_snapdir_rename(struct inode *sdip, struct dentry *sdentry, return (error); } +#ifndef HAVE_RENAME_WANTS_FLAGS +static int +zpl_snapdir_rename(struct inode *sdip, struct dentry *sdentry, + struct inode *tdip, struct dentry *tdentry) +{ + return (zpl_snapdir_rename2(sdip, sdentry, tdip, tdentry, 0)); +} +#endif + static int zpl_snapdir_rmdir(struct inode *dip, struct dentry *dentry) { @@ -405,7 +418,11 @@ const struct file_operations zpl_fops_snapdir = { const struct inode_operations zpl_ops_snapdir = { .lookup = zpl_snapdir_lookup, .getattr = zpl_snapdir_getattr, +#ifdef HAVE_RENAME_WANTS_FLAGS + .rename = zpl_snapdir_rename2, +#else .rename = zpl_snapdir_rename, +#endif .rmdir = zpl_snapdir_rmdir, .mkdir = zpl_snapdir_mkdir, }; diff --git a/module/zfs/zpl_inode.c b/module/zfs/zpl_inode.c index d26193ffa..113885ead 100644 --- a/module/zfs/zpl_inode.c +++ b/module/zfs/zpl_inode.c @@ -356,13 +356,17 @@ zpl_setattr(struct dentry *dentry, struct iattr *ia) } static int -zpl_rename(struct inode *sdip, struct dentry *sdentry, - struct inode *tdip, struct dentry *tdentry) +zpl_rename2(struct inode *sdip, struct dentry *sdentry, + struct inode *tdip, struct dentry *tdentry, unsigned int flags) { cred_t *cr = CRED(); int error; fstrans_cookie_t cookie; + /* We don't have renameat2(2) support */ + if (flags) + return (-EINVAL); + crhold(cr); cookie = spl_fstrans_mark(); error = -zfs_rename(sdip, dname(sdentry), tdip, dname(tdentry), cr, 0); @@ -373,6 +377,15 @@ zpl_rename(struct inode *sdip, struct dentry *sdentry, return (error); } +#ifndef HAVE_RENAME_WANTS_FLAGS +static int +zpl_rename(struct inode *sdip, struct dentry *sdentry, + struct inode *tdip, struct dentry *tdentry) +{ + return (zpl_rename2(sdip, sdentry, tdip, tdentry, 0)); +} +#endif + static int zpl_symlink(struct inode *dir, struct dentry *dentry, const char *name) { @@ -681,7 +694,11 @@ const struct inode_operations zpl_dir_inode_operations = { .mkdir = zpl_mkdir, .rmdir = zpl_rmdir, .mknod = zpl_mknod, +#ifdef HAVE_RENAME_WANTS_FLAGS + .rename = zpl_rename2, +#else .rename = zpl_rename, +#endif .setattr = zpl_setattr, .getattr = zpl_getattr, .setxattr = generic_setxattr, |