mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2024-12-26 03:09:34 +03:00
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 <david.chen@osnexus.com>
This commit is contained in:
parent
8ba3f2bf6a
commit
b8d9e26440
25
config/kernel-rename.m4
Normal file
25
config/kernel-rename.m4
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
dnl #
|
||||||
|
dnl # 4.9 API change,
|
||||||
|
dnl # iops->rename2() merged into iops->rename(), and iops->rename() now wants
|
||||||
|
dnl # flags.
|
||||||
|
dnl #
|
||||||
|
AC_DEFUN([ZFS_AC_KERNEL_RENAME_WANTS_FLAGS], [
|
||||||
|
AC_MSG_CHECKING([whether iops->rename() wants flags])
|
||||||
|
ZFS_LINUX_TRY_COMPILE([
|
||||||
|
#include <linux/fs.h>
|
||||||
|
int rename_fn(struct inode *sip, struct dentry *sdp,
|
||||||
|
struct inode *tip, struct dentry *tdp,
|
||||||
|
unsigned int flags) { return 0; }
|
||||||
|
|
||||||
|
static const struct inode_operations
|
||||||
|
iops __attribute__ ((unused)) = {
|
||||||
|
.rename = rename_fn,
|
||||||
|
};
|
||||||
|
],[
|
||||||
|
],[
|
||||||
|
AC_MSG_RESULT(yes)
|
||||||
|
AC_DEFINE(HAVE_RENAME_WANTS_FLAGS, 1, [iops->rename() wants flags])
|
||||||
|
],[
|
||||||
|
AC_MSG_RESULT(no)
|
||||||
|
])
|
||||||
|
])
|
@ -103,6 +103,7 @@ AC_DEFUN([ZFS_AC_CONFIG_KERNEL], [
|
|||||||
ZFS_AC_KERNEL_FPU
|
ZFS_AC_KERNEL_FPU
|
||||||
ZFS_AC_KERNEL_KUID_HELPERS
|
ZFS_AC_KERNEL_KUID_HELPERS
|
||||||
ZFS_AC_KERNEL_MODULE_PARAM_CALL_CONST
|
ZFS_AC_KERNEL_MODULE_PARAM_CALL_CONST
|
||||||
|
ZFS_AC_KERNEL_RENAME_WANTS_FLAGS
|
||||||
|
|
||||||
AS_IF([test "$LINUX_OBJ" != "$LINUX"], [
|
AS_IF([test "$LINUX_OBJ" != "$LINUX"], [
|
||||||
KERNELMAKE_PARAMS="$KERNELMAKE_PARAMS O=$LINUX_OBJ"
|
KERNELMAKE_PARAMS="$KERNELMAKE_PARAMS O=$LINUX_OBJ"
|
||||||
|
@ -301,13 +301,17 @@ zpl_snapdir_readdir(struct file *filp, void *dirent, filldir_t filldir)
|
|||||||
}
|
}
|
||||||
#endif /* HAVE_VFS_ITERATE */
|
#endif /* HAVE_VFS_ITERATE */
|
||||||
|
|
||||||
int
|
static int
|
||||||
zpl_snapdir_rename(struct inode *sdip, struct dentry *sdentry,
|
zpl_snapdir_rename2(struct inode *sdip, struct dentry *sdentry,
|
||||||
struct inode *tdip, struct dentry *tdentry)
|
struct inode *tdip, struct dentry *tdentry, unsigned int flags)
|
||||||
{
|
{
|
||||||
cred_t *cr = CRED();
|
cred_t *cr = CRED();
|
||||||
int error;
|
int error;
|
||||||
|
|
||||||
|
/* We probably don't want to support renameat2(2) in ctldir */
|
||||||
|
if (flags)
|
||||||
|
return (-EINVAL);
|
||||||
|
|
||||||
crhold(cr);
|
crhold(cr);
|
||||||
error = -zfsctl_snapdir_rename(sdip, dname(sdentry),
|
error = -zfsctl_snapdir_rename(sdip, dname(sdentry),
|
||||||
tdip, dname(tdentry), cr, 0);
|
tdip, dname(tdentry), cr, 0);
|
||||||
@ -317,6 +321,15 @@ zpl_snapdir_rename(struct inode *sdip, struct dentry *sdentry,
|
|||||||
return (error);
|
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
|
static int
|
||||||
zpl_snapdir_rmdir(struct inode *dip, struct dentry *dentry)
|
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 = {
|
const struct inode_operations zpl_ops_snapdir = {
|
||||||
.lookup = zpl_snapdir_lookup,
|
.lookup = zpl_snapdir_lookup,
|
||||||
.getattr = zpl_snapdir_getattr,
|
.getattr = zpl_snapdir_getattr,
|
||||||
|
#ifdef HAVE_RENAME_WANTS_FLAGS
|
||||||
|
.rename = zpl_snapdir_rename2,
|
||||||
|
#else
|
||||||
.rename = zpl_snapdir_rename,
|
.rename = zpl_snapdir_rename,
|
||||||
|
#endif
|
||||||
.rmdir = zpl_snapdir_rmdir,
|
.rmdir = zpl_snapdir_rmdir,
|
||||||
.mkdir = zpl_snapdir_mkdir,
|
.mkdir = zpl_snapdir_mkdir,
|
||||||
};
|
};
|
||||||
|
@ -356,13 +356,17 @@ zpl_setattr(struct dentry *dentry, struct iattr *ia)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
zpl_rename(struct inode *sdip, struct dentry *sdentry,
|
zpl_rename2(struct inode *sdip, struct dentry *sdentry,
|
||||||
struct inode *tdip, struct dentry *tdentry)
|
struct inode *tdip, struct dentry *tdentry, unsigned int flags)
|
||||||
{
|
{
|
||||||
cred_t *cr = CRED();
|
cred_t *cr = CRED();
|
||||||
int error;
|
int error;
|
||||||
fstrans_cookie_t cookie;
|
fstrans_cookie_t cookie;
|
||||||
|
|
||||||
|
/* We don't have renameat2(2) support */
|
||||||
|
if (flags)
|
||||||
|
return (-EINVAL);
|
||||||
|
|
||||||
crhold(cr);
|
crhold(cr);
|
||||||
cookie = spl_fstrans_mark();
|
cookie = spl_fstrans_mark();
|
||||||
error = -zfs_rename(sdip, dname(sdentry), tdip, dname(tdentry), cr, 0);
|
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);
|
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
|
static int
|
||||||
zpl_symlink(struct inode *dir, struct dentry *dentry, const char *name)
|
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,
|
.mkdir = zpl_mkdir,
|
||||||
.rmdir = zpl_rmdir,
|
.rmdir = zpl_rmdir,
|
||||||
.mknod = zpl_mknod,
|
.mknod = zpl_mknod,
|
||||||
|
#ifdef HAVE_RENAME_WANTS_FLAGS
|
||||||
|
.rename = zpl_rename2,
|
||||||
|
#else
|
||||||
.rename = zpl_rename,
|
.rename = zpl_rename,
|
||||||
|
#endif
|
||||||
.setattr = zpl_setattr,
|
.setattr = zpl_setattr,
|
||||||
.getattr = zpl_getattr,
|
.getattr = zpl_getattr,
|
||||||
.setxattr = generic_setxattr,
|
.setxattr = generic_setxattr,
|
||||||
|
Loading…
Reference in New Issue
Block a user