Skip to content

Instantly share code, notes, and snippets.

@truatpasteurdotfr
Created May 1, 2018 23:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save truatpasteurdotfr/7508b86a692244340f3debeb6ae855d9 to your computer and use it in GitHub Desktop.
Save truatpasteurdotfr/7508b86a692244340f3debeb6ae855d9 to your computer and use it in GitHub Desktop.
diff -uNr zfs-0.6.5.11/config/kernel-vfs-iterate.m4 zfs-0.6.5.11-7463.2/config/kernel-vfs-iterate.m4
--- zfs-0.6.5.11/config/kernel-vfs-iterate.m4 2017-07-10 22:22:17.000000000 +0200
+++ zfs-0.6.5.11-7463.2/config/kernel-vfs-iterate.m4 2018-05-02 00:29:34.000000000 +0200
@@ -23,16 +23,27 @@
dnl #
dnl # 3.11 API change
dnl #
+ dnl # RHEL 7.5 compatibility; the fops.iterate() method was
+ dnl # added to the file_operations structure but in order to
+ dnl # maintain KABI compatibility all callers must set
+ dnl # FMODE_KABI_ITERATE which is checked in iterate_dir().
+ dnl # When detected ignore this interface and fallback to
+ dnl # to using fops.readdir() to retain KABI compatibility.
+ dnl #
AC_MSG_CHECKING([whether fops->iterate() is available])
ZFS_LINUX_TRY_COMPILE([
#include <linux/fs.h>
- int iterate(struct file *filp, struct dir_context * context)
- { return 0; }
+ int iterate(struct file *filp,
+ struct dir_context *context) { return 0; }
static const struct file_operations fops
__attribute__ ((unused)) = {
.iterate = iterate,
};
+
+ #if defined(FMODE_KABI_ITERATE)
+ #error "RHEL 7.5, FMODE_KABI_ITERATE interface"
+ #endif
],[
],[
AC_MSG_RESULT(yes)
@@ -44,8 +55,8 @@
AC_MSG_CHECKING([whether fops->readdir() is available])
ZFS_LINUX_TRY_COMPILE([
#include <linux/fs.h>
- int readdir(struct file *filp, void *entry, filldir_t func)
- { return 0; }
+ int readdir(struct file *filp, void *entry,
+ filldir_t func) { return 0; }
static const struct file_operations fops
__attribute__ ((unused)) = {
@@ -57,7 +68,7 @@
AC_DEFINE(HAVE_VFS_READDIR, 1,
[fops->readdir() is available])
],[
- AC_MSG_ERROR(no; file a bug report with ZFSOnLinux)
+ AC_MSG_ERROR(no; file a bug report with ZoL)
])
])
])
diff -uNr zfs-0.6.5.11/include/sys/zfs_vnops.h zfs-0.6.5.11-7463.2/include/sys/zfs_vnops.h
--- zfs-0.6.5.11/include/sys/zfs_vnops.h 2017-07-10 22:22:16.000000000 +0200
+++ zfs-0.6.5.11-7463.2/include/sys/zfs_vnops.h 2018-05-02 00:29:34.000000000 +0200
@@ -52,7 +52,7 @@
struct inode **ipp, cred_t *cr, int flags, vsecattr_t *vsecp);
extern int zfs_rmdir(struct inode *dip, char *name, struct inode *cwd,
cred_t *cr, int flags);
-extern int zfs_readdir(struct inode *ip, struct dir_context *ctx, cred_t *cr);
+extern int zfs_readdir(struct inode *ip, zpl_dir_context_t *ctx, cred_t *cr);
extern int zfs_fsync(struct inode *ip, int syncflag, cred_t *cr);
extern int zfs_getattr(struct inode *ip, vattr_t *vap, int flag, cred_t *cr);
extern int zfs_getattr_fast(struct inode *ip, struct kstat *sp);
diff -uNr zfs-0.6.5.11/include/sys/zpl.h zfs-0.6.5.11-7463.2/include/sys/zpl.h
--- zfs-0.6.5.11/include/sys/zpl.h 2017-07-10 22:22:16.000000000 +0200
+++ zfs-0.6.5.11-7463.2/include/sys/zpl.h 2018-05-02 01:09:01.000000000 +0200
@@ -125,27 +125,34 @@
#if defined(HAVE_VFS_ITERATE) || defined(HAVE_VFS_ITERATE_SHARED)
-#define DIR_CONTEXT_INIT(_dirent, _actor, _pos) { \
+#define ZPL_DIR_CONTEXT_INIT(_dirent, _actor, _pos) { \
.actor = _actor, \
.pos = _pos, \
}
+typedef struct dir_context zpl_dir_context_t;
+
+#define zpl_dir_emit dir_emit
+#define zpl_dir_emit_dot dir_emit_dot
+#define zpl_dir_emit_dotdot dir_emit_dotdot
+#define zpl_dir_emit_dots dir_emit_dots
+
#else
-typedef struct dir_context {
+typedef struct zpl_dir_context {
void *dirent;
const filldir_t actor;
loff_t pos;
-} dir_context_t;
+} zpl_dir_context_t;
-#define DIR_CONTEXT_INIT(_dirent, _actor, _pos) { \
+#define ZPL_DIR_CONTEXT_INIT(_dirent, _actor, _pos) { \
.dirent = _dirent, \
.actor = _actor, \
.pos = _pos, \
}
static inline bool
-dir_emit(struct dir_context *ctx, const char *name, int namelen,
+zpl_dir_emit(zpl_dir_context_t *ctx, const char *name, int namelen,
uint64_t ino, unsigned type)
{
return (ctx->actor(ctx->dirent, name, namelen, ctx->pos, ino, type)
@@ -153,29 +160,29 @@
}
static inline bool
-dir_emit_dot(struct file *file, struct dir_context *ctx)
+zpl_dir_emit_dot(struct file *file, zpl_dir_context_t *ctx)
{
return (ctx->actor(ctx->dirent, ".", 1, ctx->pos,
file->f_path.dentry->d_inode->i_ino, DT_DIR) == 0);
}
static inline bool
-dir_emit_dotdot(struct file *file, struct dir_context *ctx)
+zpl_dir_emit_dotdot(struct file *file, zpl_dir_context_t *ctx)
{
return (ctx->actor(ctx->dirent, "..", 2, ctx->pos,
parent_ino(file->f_path.dentry), DT_DIR) == 0);
}
static inline bool
-dir_emit_dots(struct file *file, struct dir_context *ctx)
+zpl_dir_emit_dots(struct file *file, zpl_dir_context_t *ctx)
{
if (ctx->pos == 0) {
- if (!dir_emit_dot(file, ctx))
+ if (!zpl_dir_emit_dot(file, ctx))
return (false);
ctx->pos = 1;
}
if (ctx->pos == 1) {
- if (!dir_emit_dotdot(file, ctx))
+ if (!zpl_dir_emit_dotdot(file, ctx))
return (false);
ctx->pos = 2;
}
diff -uNr zfs-0.6.5.11/module/zfs/zfs_vnops.c zfs-0.6.5.11-7463.2/module/zfs/zfs_vnops.c
--- zfs-0.6.5.11/module/zfs/zfs_vnops.c 2017-07-10 22:27:31.000000000 +0200
+++ zfs-0.6.5.11-7463.2/module/zfs/zfs_vnops.c 2018-05-02 01:21:56.000000000 +0200
@@ -2010,7 +2010,7 @@
*/
/* ARGSUSED */
int
-zfs_readdir(struct inode *ip, struct dir_context *ctx, cred_t *cr)
+zfs_readdir(struct inode *ip, zpl_dir_context_t *ctx, cred_t *cr)
{
znode_t *zp = ITOZ(ip);
zfs_sb_t *zsb = ITOZSB(ip);
@@ -2115,7 +2115,7 @@
type = ZFS_DIRENT_TYPE(zap.za_first_integer);
}
- done = !dir_emit(ctx, zap.za_name, strlen(zap.za_name),
+ done = !zpl_dir_emit(ctx, zap.za_name, strlen(zap.za_name),
objnum, type);
if (done)
break;
diff -uNr zfs-0.6.5.11/module/zfs/zpl_ctldir.c zfs-0.6.5.11-7463.2/module/zfs/zpl_ctldir.c
--- zfs-0.6.5.11/module/zfs/zpl_ctldir.c 2017-07-10 22:27:31.000000000 +0200
+++ zfs-0.6.5.11-7463.2/module/zfs/zpl_ctldir.c 2018-05-02 01:21:56.000000000 +0200
@@ -50,27 +50,27 @@
* Get root directory contents.
*/
static int
-zpl_root_iterate(struct file *filp, struct dir_context *ctx)
+zpl_root_iterate(struct file *filp, zpl_dir_context_t *ctx)
{
zfs_sb_t *zsb = ITOZSB(filp->f_path.dentry->d_inode);
int error = 0;
ZFS_ENTER(zsb);
- if (!dir_emit_dots(filp, ctx))
+ if (!zpl_dir_emit_dots(filp, ctx))
goto out;
if (ctx->pos == 2) {
- if (!dir_emit(ctx, ZFS_SNAPDIR_NAME, strlen(ZFS_SNAPDIR_NAME),
- ZFSCTL_INO_SNAPDIR, DT_DIR))
+ if (!zpl_dir_emit(ctx, ZFS_SNAPDIR_NAME,
+ strlen(ZFS_SNAPDIR_NAME), ZFSCTL_INO_SNAPDIR, DT_DIR))
goto out;
ctx->pos++;
}
if (ctx->pos == 3) {
- if (!dir_emit(ctx, ZFS_SHAREDIR_NAME, strlen(ZFS_SHAREDIR_NAME),
- ZFSCTL_INO_SHARES, DT_DIR))
+ if (!zpl_dir_emit(ctx, ZFS_SHAREDIR_NAME,
+ strlen(ZFS_SHAREDIR_NAME), ZFSCTL_INO_SHARES, DT_DIR))
goto out;
ctx->pos++;
@@ -85,7 +85,8 @@
static int
zpl_root_readdir(struct file *filp, void *dirent, filldir_t filldir)
{
- struct dir_context ctx = DIR_CONTEXT_INIT(dirent, filldir, filp->f_pos);
+ zpl_dir_context_t ctx =
+ ZPL_DIR_CONTEXT_INIT(dirent, filldir, filp->f_pos);
int error;
error = zpl_root_iterate(filp, &ctx);
@@ -93,7 +94,7 @@
return (error);
}
-#endif /* HAVE_VFS_ITERATE */
+#endif /* !HAVE_VFS_ITERATE && !HAVE_VFS_ITERATE_SHARED */
/*
* Get root directory attributes.
@@ -248,7 +249,7 @@
}
static int
-zpl_snapdir_iterate(struct file *filp, struct dir_context *ctx)
+zpl_snapdir_iterate(struct file *filp, zpl_dir_context_t *ctx)
{
zfs_sb_t *zsb = ITOZSB(filp->f_path.dentry->d_inode);
fstrans_cookie_t cookie;
@@ -260,7 +261,7 @@
ZFS_ENTER(zsb);
cookie = spl_fstrans_mark();
- if (!dir_emit_dots(filp, ctx))
+ if (!zpl_dir_emit_dots(filp, ctx))
goto out;
pos = ctx->pos;
@@ -272,7 +273,7 @@
if (error)
goto out;
- if (!dir_emit(ctx, snapname, strlen(snapname),
+ if (!zpl_dir_emit(ctx, snapname, strlen(snapname),
ZFSCTL_INO_SHARES - id, DT_DIR))
goto out;
@@ -292,7 +293,8 @@
static int
zpl_snapdir_readdir(struct file *filp, void *dirent, filldir_t filldir)
{
- struct dir_context ctx = DIR_CONTEXT_INIT(dirent, filldir, filp->f_pos);
+ zpl_dir_context_t ctx =
+ ZPL_DIR_CONTEXT_INIT(dirent, filldir, filp->f_pos);
int error;
error = zpl_snapdir_iterate(filp, &ctx);
@@ -300,7 +302,7 @@
return (error);
}
-#endif /* HAVE_VFS_ITERATE */
+#endif /* !HAVE_VFS_ITERATE && !HAVE_VFS_ITERATE_SHARED */
static int
zpl_snapdir_rename2(struct inode *sdip, struct dentry *sdentry,
@@ -462,7 +464,7 @@
}
static int
-zpl_shares_iterate(struct file *filp, struct dir_context *ctx)
+zpl_shares_iterate(struct file *filp, zpl_dir_context_t *ctx)
{
fstrans_cookie_t cookie;
cred_t *cr = CRED();
@@ -474,7 +476,7 @@
cookie = spl_fstrans_mark();
if (zsb->z_shares_dir == 0) {
- dir_emit_dots(filp, ctx);
+ zpl_dir_emit_dots(filp, ctx);
goto out;
}
@@ -499,7 +501,8 @@
static int
zpl_shares_readdir(struct file *filp, void *dirent, filldir_t filldir)
{
- struct dir_context ctx = DIR_CONTEXT_INIT(dirent, filldir, filp->f_pos);
+ zpl_dir_context_t ctx =
+ ZPL_DIR_CONTEXT_INIT(dirent, filldir, filp->f_pos);
int error;
error = zpl_shares_iterate(filp, &ctx);
@@ -507,7 +510,7 @@
return (error);
}
-#endif /* HAVE_VFS_ITERATE */
+#endif /* !HAVE_VFS_ITERATE && !HAVE_VFS_ITERATE_SHARED */
/* ARGSUSED */
static int
diff -uNr zfs-0.6.5.11/module/zfs/zpl_file.c zfs-0.6.5.11-7463.2/module/zfs/zpl_file.c
--- zfs-0.6.5.11/module/zfs/zpl_file.c 2017-07-10 22:27:31.000000000 +0200
+++ zfs-0.6.5.11-7463.2/module/zfs/zpl_file.c 2018-05-02 01:21:56.000000000 +0200
@@ -76,7 +76,7 @@
}
static int
-zpl_iterate(struct file *filp, struct dir_context *ctx)
+zpl_iterate(struct file *filp, zpl_dir_context_t *ctx)
{
struct dentry *dentry = filp->f_path.dentry;
cred_t *cr = CRED();
@@ -97,7 +97,8 @@
static int
zpl_readdir(struct file *filp, void *dirent, filldir_t filldir)
{
- struct dir_context ctx = DIR_CONTEXT_INIT(dirent, filldir, filp->f_pos);
+ zpl_dir_context_t ctx =
+ ZPL_DIR_CONTEXT_INIT(dirent, filldir, filp->f_pos);
int error;
error = zpl_iterate(filp, &ctx);
@@ -105,7 +106,7 @@
return (error);
}
-#endif /* HAVE_VFS_ITERATE */
+#endif /* !HAVE_VFS_ITERATE && !HAVE_VFS_ITERATE_SHARED */
#if defined(HAVE_FSYNC_WITH_DENTRY)
/*
@@ -886,7 +887,7 @@
const struct file_operations zpl_dir_file_operations = {
.llseek = generic_file_llseek,
.read = generic_read_dir,
-#ifdef HAVE_VFS_ITERATE_SHARED
+#if defined(HAVE_VFS_ITERATE_SHARED)
.iterate_shared = zpl_iterate,
#elif defined(HAVE_VFS_ITERATE)
.iterate = zpl_iterate,
diff -uNr zfs-0.6.5.11/rpm/generic/zfs-dkms.spec.in zfs-0.6.5.11-7463.2/rpm/generic/zfs-dkms.spec.in
--- zfs-0.6.5.11/rpm/generic/zfs-dkms.spec.in 2017-07-10 22:22:15.000000000 +0200
+++ zfs-0.6.5.11-7463.2/rpm/generic/zfs-dkms.spec.in 2018-05-02 01:16:55.000000000 +0200
@@ -6,7 +6,7 @@
Name: %{module}-dkms
Version: @VERSION@
-Release: @RELEASE@%{?dist}
+Release: @RELEASE@%{?dist}.7463.2
Summary: Kernel module(s) (dkms)
Group: System Environment/Kernel
diff -uNr zfs-0.6.5.11/rpm/generic/zfs-kmod.spec.in zfs-0.6.5.11-7463.2/rpm/generic/zfs-kmod.spec.in
--- zfs-0.6.5.11/rpm/generic/zfs-kmod.spec.in 2017-07-10 22:22:15.000000000 +0200
+++ zfs-0.6.5.11-7463.2/rpm/generic/zfs-kmod.spec.in 2018-05-02 01:17:06.000000000 +0200
@@ -43,7 +43,7 @@
Name: %{module}-kmod
Version: @VERSION@
-Release: @RELEASE@%{?dist}
+Release: @RELEASE@%{?dist}.7463.2
Summary: Kernel module(s)
Group: System Environment/Kernel
diff -uNr zfs-0.6.5.11/rpm/generic/zfs.spec.in zfs-0.6.5.11-7463.2/rpm/generic/zfs.spec.in
--- zfs-0.6.5.11/rpm/generic/zfs.spec.in 2017-07-10 22:22:15.000000000 +0200
+++ zfs-0.6.5.11-7463.2/rpm/generic/zfs.spec.in 2018-05-02 01:17:17.000000000 +0200
@@ -62,7 +62,7 @@
Name: @PACKAGE@
Version: @VERSION@
-Release: @RELEASE@%{?dist}
+Release: @RELEASE@%{?dist}.7463.2
Summary: Commands to control the kernel modules and libraries
Group: System Environment/Kernel
diff -uNr zfs-0.6.5.11/rpm/redhat/zfs-dkms.spec.in zfs-0.6.5.11-7463.2/rpm/redhat/zfs-dkms.spec.in
--- zfs-0.6.5.11/rpm/redhat/zfs-dkms.spec.in 2017-07-10 22:22:15.000000000 +0200
+++ zfs-0.6.5.11-7463.2/rpm/redhat/zfs-dkms.spec.in 2018-05-02 01:17:30.000000000 +0200
@@ -6,7 +6,7 @@
Name: %{module}-dkms
Version: @VERSION@
-Release: @RELEASE@%{?dist}
+Release: @RELEASE@%{?dist}.7463.2
Summary: Kernel module(s) (dkms)
Group: System Environment/Kernel
diff -uNr zfs-0.6.5.11/rpm/redhat/zfs-kmod.spec.in zfs-0.6.5.11-7463.2/rpm/redhat/zfs-kmod.spec.in
--- zfs-0.6.5.11/rpm/redhat/zfs-kmod.spec.in 2017-07-10 22:22:15.000000000 +0200
+++ zfs-0.6.5.11-7463.2/rpm/redhat/zfs-kmod.spec.in 2018-05-02 01:17:34.000000000 +0200
@@ -3,7 +3,7 @@
Name: @PACKAGE@-kmod
Version: @VERSION@
-Release: @RELEASE@%{?dist}
+Release: @RELEASE@%{?dist}.7463.2
Summary: Kernel module(s)
Group: System Environment/Kernel
diff -uNr zfs-0.6.5.11/rpm/redhat/zfs.spec.in zfs-0.6.5.11-7463.2/rpm/redhat/zfs.spec.in
--- zfs-0.6.5.11/rpm/redhat/zfs.spec.in 2017-07-10 22:22:15.000000000 +0200
+++ zfs-0.6.5.11-7463.2/rpm/redhat/zfs.spec.in 2018-05-02 01:17:54.000000000 +0200
@@ -62,7 +62,7 @@
Name: @PACKAGE@
Version: @VERSION@
-Release: @RELEASE@%{?dist}
+Release: @RELEASE@%{?dist}.7463.2
Summary: Commands to control the kernel modules and libraries
Group: System Environment/Kernel
diff -uNr zfs-0.6.5.11/scripts/common.sh zfs-0.6.5.11-7463.2/scripts/common.sh
--- zfs-0.6.5.11/scripts/common.sh 2017-07-10 22:27:03.000000000 +0200
+++ zfs-0.6.5.11-7463.2/scripts/common.sh 2018-05-02 01:19:37.000000000 +0200
@@ -35,8 +35,8 @@
pkgdatadir=${prefix}/share/zfs
bindir=${exec_prefix}/bin
sbindir=${exec_prefix}/sbin
-udevdir=
-udevruledir=
+udevdir=/lib/udev
+udevruledir=/lib/udev/rules.d
sysconfdir=${prefix}/etc
localstatedir=${prefix}/var
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment