ocfs2 1.6 - fourth set
The next set. The previous 3 sets have been pushed to the git repo.
PATCH 1/8 ocfs2: Handle missing macro MNT_RELATIME
Mainline commit 47ae32d6a54955a041cdc30b06d0bb16e75f68d5 added macro MNT_RELATIME.
It should be noted that the functionality will not be available on EL5 as the vfs support is missing.
TODO: This feature needs to be enabled by parsing the realtime mount option in ocfs2 itself.
--- Makefile | 3 ++- configure.in | 5 +++++ kapi-compat/include/relatime.h | 6 ++++++ 3 files changed, 13 insertions(+), 1 deletions(-) create mode 100644 kapi-compat/include/relatime.h
Makefile +2 -1
@@ -16,7 +16,8 @@ KAPI_COMPAT_FILES = \ kapi-compat/include/sync_mapping.h \ kapi-compat/include/fpath.h \ kapi-compat/include/ushortmax.h \ - kapi-compat/include/fversion.h + kapi-compat/include/fversion.h \ + kapi-compat/include/relatime.h PATCH_FILES =
configure.in +5 -0
@@ -271,6 +271,11 @@ OCFS2_CHECK_KERNEL([seq_open() has const struct seq_operations * in seq_file.h], , SEQOP_IS_NOT_CONST=yes, [int seq_open(struct file \*, const struct seq_operations \*);]) AC_SUBST(SEQOP_IS_NOT_CONST) +relatime_compat_header="" +OCFS2_CHECK_KERNEL([MNT_RELATIME in mount.h], mount.h, + , relatime_compat_header=relatime.h, [^#define MNT_RELATIME]) +KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS $relatime_compat_header" + # End kapi_compat checks
kapi-compat/include/relatime.h new file +6 -0
@@ -0,0 +1,6 @@ +#ifndef KAPI_RELATIME_H +#define KAPI_RELATIME_H + +#define MNT_RELATIME 0x20 + +#endif
Signature · 1 line
1.5.6.5
PATCH 2/8 ocfs2: Handle missing vectorized fileops aio_read() and aio_write()
In reply to Sunil MushranMainline commit 027445c37282bc1ed26add45e573ad2d3e4860a5 vectorized fileops aio_read() and aio_write().
Patch provides support for the non-vectorized fileops (in EL5) by hand crafting the iovec with the provided buf and buflen.
--- Config.make.in | 1 + Makefile | 3 +- configure.in | 6 ++++ fs/ocfs2/Makefile | 4 +++ fs/ocfs2/file.c | 6 ++-- fs/ocfs2/kapi-default.h | 7 +++++ kapi-compat/include/aiovec.h | 57 ++++++++++++++++++++++++++++++++++++++++++ 7 files changed, 80 insertions(+), 4 deletions(-) create mode 100644 kapi-compat/include/aiovec.h
Config.make.in +1 -0
@@ -70,6 +70,7 @@ EXPORTOP_IS_NOT_CONST = @EXPORTOP_IS_NOT_CONST@ MATCHTABLE_IS_NOT_CONST = @MATCHTABLE_IS_NOT_CONST@ VMOP_IS_NOT_CONST = @VMOP_IS_NOT_CONST@ SEQOP_IS_NOT_CONST = @SEQOP_IS_NOT_CONST@ +NO_VECTORIZED_AIO = @NO_VECTORIZED_AIO@ OCFS_DEBUG = @OCFS_DEBUG@
Makefile +2 -1
@@ -17,7 +17,8 @@ KAPI_COMPAT_FILES = \ kapi-compat/include/fpath.h \ kapi-compat/include/ushortmax.h \ kapi-compat/include/fversion.h \ - kapi-compat/include/relatime.h + kapi-compat/include/relatime.h \ + kapi-compat/include/aiovec.h PATCH_FILES =
configure.in +6 -0
@@ -276,6 +276,12 @@ OCFS2_CHECK_KERNEL([MNT_RELATIME in mount.h], mount.h, , relatime_compat_header=relatime.h, [^#define MNT_RELATIME]) KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS $relatime_compat_header" +NO_VECTORIZED_AIO= +OCFS2_CHECK_KERNEL([aio_read() in struct file_operations using iovec in fs.h], fs.h, + , NO_VECTORIZED_AIO=aiovec.h, [ssize_t (\*aio_read) (struct kiocb \*, const struct iovec \*, unsigned long, loff_t);]) +AC_SUBST(NO_VECTORIZED_AIO) +KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS $NO_VECTORIZED_AIO" + # End kapi_compat checks
fs/ocfs2/Makefile +4 -0
@@ -84,6 +84,10 @@ ifdef VMOP_IS_NOT_CONST EXTRA_CFLAGS += -DVMOP_IS_NOT_CONST endif +ifdef NO_VECTORIZED_AIO +CFLAGS_file.o += -DNO_VECTORIZED_AIO +endif + # # Since SUBDIRS means something to kbuild, define them safely. Do not # include trailing slashes.
fs/ocfs2/file.c +3 -3
@@ -1892,7 +1892,7 @@ out:return ret; } -static ssize_t ocfs2_file_aio_write (struct kiocb *iocb, +static ssize_t __ocfs2_file_aio_write (struct kiocb *iocb,const struct iovec *iov,unsigned long nr_segs,loff_t pos)
@@ -2168,7 +2168,7 @@ bail:return ret; } -static ssize_t ocfs2_file_aio_read (struct kiocb *iocb, +static ssize_t __ocfs2_file_aio_read (struct kiocb *iocb,const struct iovec *iov,unsigned long nr_segs,loff_t pos)
@@ -2222,7 +2222,7 @@ static ssize_t ocfs2_file_aio_read(struct kiocb *iocb, }ocfs2_inode_unlock (inode, lock_level); - ret =generic_file_aio_read (iocb, iov, nr_segs, iocb->ki_pos); + ret =kapi_generic_file_aio_read (iocb, iov, nr_segs, iocb->ki_pos);if (ret == -EINVAL )mlog (0 ,"generic_file_aio_read returned -EINVAL\n" );
fs/ocfs2/kapi-default.h +7 -0
@@ -39,4 +39,11 @@ typedef struct work_struct kapi_work_struct_t;typedef u64 f_version_t ;#endif +#ifndef kapi_generic_file_aio_read +# define kapi_generic_file_aio_read (a, b, c, d) \ + generic_file_aio_read(a, b, c, d) +# define ocfs2_file_aio_read __ocfs2_file_aio_read +# define ocfs2_file_aio_write __ocfs2_file_aio_write +#endif +#endif
kapi-compat/include/aiovec.h new file +57 -0
57 lines not on this page · raw message
Signature · 1 line
1.5.6.5
PATCH 3/8 ocfs2: Handle older prototype of iops->permission()
In reply to Sunil MushranMainline commit e6305c43eda10ebfd2ad9e35d6e172ccc7bb3695 changed the prototype of iops->permission() by dropping the last argument.
- int (*permission) (struct inode *, int, struct nameidata *);
+ int (*permission) (struct inode *, int);
Patch allows building with kernels having the older prototype.
--- Config.make.in | 1 + configure.in | 13 +++++++++++++ fs/ocfs2/Makefile | 4 ++++ fs/ocfs2/file.c | 4 ++++ fs/ocfs2/file.h | 4 ++++ 5 files changed, 26 insertions(+), 0 deletions(-)
Config.make.in +1 -0
@@ -71,6 +71,7 @@ MATCHTABLE_IS_NOT_CONST = @MATCHTABLE_IS_NOT_CONST@ VMOP_IS_NOT_CONST = @VMOP_IS_NOT_CONST@ SEQOP_IS_NOT_CONST = @SEQOP_IS_NOT_CONST@ NO_VECTORIZED_AIO = @NO_VECTORIZED_AIO@ +OLD_PERMISSION = @OLD_PERMISSION@ OCFS_DEBUG = @OCFS_DEBUG@
configure.in +13 -0
@@ -282,6 +282,19 @@ OCFS2_CHECK_KERNEL([aio_read() in struct file_operations using iovec in fs.h], f AC_SUBST(NO_VECTORIZED_AIO) KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS $NO_VECTORIZED_AIO" +OLD_PERSMISSION= +OCFS2_CHECK_KERNEL([ older prototype of iops->permission() in fs.h], fs.h, +OLD_PERSMISSION=yes, , [int (\*permission) (struct inode \*, int, struct nameidata \*);]) +AC_SUBST(OLD_PERSMISSION) +if test "x$OLD_PERSMISSION" = "x" ; then + new_permission= + OCFS2_CHECK_KERNEL([ newer prototype of iops->permission() in fs.h], fs.h, + new_permission=yes, , [int (\*permission) (struct inode \*, int);]) + if test "x$new_permission" = "x" ; then + AC_MSG_ERROR(Cannot build with kernel as the prototype of iops->permission is not recognized) + fi +fi + # End kapi_compat checks
fs/ocfs2/Makefile +4 -0
@@ -88,6 +88,10 @@ ifdef NO_VECTORIZED_AIO CFLAGS_file.o += -DNO_VECTORIZED_AIO endif +ifdef OLD_PERMISSION +EXTRA_CFLAGS += -DOLD_PERMISSION +endif + # # Since SUBDIRS means something to kbuild, define them safely. Do not # include trailing slashes.
fs/ocfs2/file.c +4 -0
@@ -1138,7 +1138,11 @@ bail:return err; } +#ifdef OLD_PERMISSION +int ocfs2_permission(struct inode *inode, int mask, struct nameidata *nd) +#else int ocfs2_permission(struct inode *inode, int mask) +#endif {int ret;
fs/ocfs2/file.h +4 -0
@@ -64,7 +64,11 @@ int ocfs2_extend_no_holes(struct inode *inode, u64 new_i_size,int ocfs2_setattr (struct dentry *dentry,struct iattr *attr);int ocfs2_getattr (struct vfsmount *mnt,struct dentry *dentry,struct kstat *stat); +#ifdef OLD_PERMISSION +int ocfs2_permission (struct inode *inode,int mask,struct nameidata *nd); +#else int ocfs2_permission (struct inode *inode,int mask); +#endif int ocfs2_should_update_atime (struct inode *inode,struct vfsmount *vfsmnt);
Signature · 1 line
1.5.6.5
PATCH 4/8 ocfs2: Handle missing helper mandatory_lock()
In reply to Sunil MushranMainline commit a16877ca9cec211708a161057a7cbfbf2cbc3a53 added helper mandatory_lock().
--- Makefile | 3 ++- configure.in | 4 ++++ kapi-compat/include/mandatory_lock.h | 25 +++++++++++++++++++++++++ 3 files changed, 31 insertions(+), 1 deletions(-) create mode 100644 kapi-compat/include/mandatory_lock.h
Makefile +2 -1
@@ -18,7 +18,8 @@ KAPI_COMPAT_FILES = \ kapi-compat/include/ushortmax.h \ kapi-compat/include/fversion.h \ kapi-compat/include/relatime.h \ - kapi-compat/include/aiovec.h + kapi-compat/include/aiovec.h \ + kapi-compat/include/mandatory_lock.h PATCH_FILES =
configure.in +4 -0
@@ -295,6 +295,10 @@ if test "x$OLD_PERSMISSION" = "x" ; then fi fi +mandatory_lock_header= +OCFS2_CHECK_KERNEL([mandatory_lock() in fs.h], fs.h, + , mandatory_lock_header=mandatory_lock.h, [^static inline int mandatory_lock(]) +KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS $mandatory_lock_header" # End kapi_compat checks
kapi-compat/include/mandatory_lock.h new file +25 -0
@@ -0,0 +1,25 @@ +#ifndef KAPI_MANDATORY_LOCK_H +#define KAPI_MANDATORY_LOCK_H + +#include <linux/fs.h> +/* +* Candidates for mandatory locking have the setgid bit set +* but no group execute bit - an otherwise meaningless combination. +*/ + +static inline int __mandatory_lock (struct inode *ino) +{ +return (ino->i_mode & (S_ISGID |S_IXGRP )) ==S_ISGID ; +} + +/* +* ... and these candidates should be on MS_MANDLOCK mounted fs, +* otherwise these will be advisory locks +*/ + +static inline int mandatory_lock (struct inode *ino) +{ +return IS_MANDLOCK (ino) &&__mandatory_lock (ino); +} + +#endif /* KAPI_MANDATORY_LOCK_H */
Signature · 1 line
1.5.6.5
PATCH 5/8 ocfs2: Handle missing helper current_fsuid()
In reply to Sunil MushranMainline commit 86a264abe542cfececb4df129bc45a0338d8cdb9 added helper current_fsuid().
An earlier commit grouped security credentials in struct task in struct cred. The patch ensures that if the above helper is not found, that struct cred is missing. If not, build fails.
--- Makefile | 3 ++- configure.in | 13 +++++++++++++ kapi-compat/include/fsuid.h | 7 +++++++ 3 files changed, 22 insertions(+), 1 deletions(-) create mode 100644 kapi-compat/include/fsuid.h
Makefile +2 -1
@@ -19,7 +19,8 @@ KAPI_COMPAT_FILES = \ kapi-compat/include/fversion.h \ kapi-compat/include/relatime.h \ kapi-compat/include/aiovec.h \ - kapi-compat/include/mandatory_lock.h + kapi-compat/include/mandatory_lock.h \ + kapi-compat/include/fsuid.h PATCH_FILES =
configure.in +13 -0
@@ -300,6 +300,19 @@ OCFS2_CHECK_KERNEL([mandatory_lock() in fs.h], fs.h, , mandatory_lock_header=mandatory_lock.h, [^static inline int mandatory_lock(]) KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS $mandatory_lock_header" +no_current_fsuid= +OCFS2_CHECK_KERNEL([current_fsuid() in cred.h], cred.h, + , no_current_fsuid=fsuid.h, [#define current_fsuid()]) +if test "x$no_current_fsuid" = "xfsuid.h" ; then + fsuid_in_task= + OCFS2_CHECK_KERNEL([ fsuid in struct task in sched.h], sched.h, + fsuid_in_task=yes, , [uid_t uid,euid,suid,fsuid;]) + if test "x$fsuid_in_task" = "x" ; then + AC_MSG_ERROR(Cannot build with kernel that is missing fsuid and struct cred in struct task) + fi +fi +KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS $no_current_fsuid" + # End kapi_compat checks # using -include has two advantages:
kapi-compat/include/fsuid.h new file +7 -0
@@ -0,0 +1,7 @@ +#ifndef KAPI_FSUID_H +#define KAPI_FSUID_H + +#define current_fsuid () (current->fsuid) +#define current_fsgid () (current->fsgid) + +#endif
Signature · 1 line
1.5.6.5
PATCH 6/8 ocfs2: Handle missing enum umh_wait
In reply to Sunil MushranMainline commit 86313c488a6848b7ec2ba04e74f25f79dd32a0b7 added enum umh_wait in kmod.h.
--- Makefile | 3 ++- configure.in | 5 +++++ kapi-compat/include/umh_wait.h | 10 ++++++++++ 3 files changed, 17 insertions(+), 1 deletions(-) create mode 100644 kapi-compat/include/umh_wait.h
Makefile +2 -1
@@ -20,7 +20,8 @@ KAPI_COMPAT_FILES = \ kapi-compat/include/relatime.h \ kapi-compat/include/aiovec.h \ kapi-compat/include/mandatory_lock.h \ - kapi-compat/include/fsuid.h + kapi-compat/include/fsuid.h \ + kapi-compat/include/umh_wait.h PATCH_FILES =
configure.in +5 -0
@@ -313,6 +313,11 @@ if test "x$no_current_fsuid" = "xfsuid.h" ; then fi KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS $no_current_fsuid" +kmod_compat_header= +OCFS2_CHECK_KERNEL([enum umh_wait in kmod.h], kmod.h, + , kmod_compat_header=umh_wait.h, [enum umh_wait {]) +KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS $kmod_compat_header" + # End kapi_compat checks # using -include has two advantages:
kapi-compat/include/umh_wait.h new file +10 -0
@@ -0,0 +1,10 @@ +#ifndef KAPI_KMOD_H +#define KAPI_KMOD_H + +enum umh_wait { +UMH_NO_WAIT =-1 ,/* don't wait at all */ +UMH_WAIT_EXEC =0 ,/* wait for the exec, but not the process */ +UMH_WAIT_PROC =1 ,/* wait for the process to complete */ +}; + +#endif
Signature · 1 line
1.5.6.5
PATCH 7/8 ocfs2: Handle older prototype of register_sysctl_table()
In reply to Sunil MushranMainline commit 0b4d414714f0d2f922d39424b0c5c82ad900a381 removed the insert_at_head argument from register_sysctl_table(). Patch allows building with older kernels.
--- Makefile | 3 ++- configure.in | 5 +++++ fs/ocfs2/kapi-default.h | 4 ++++ fs/ocfs2/stackglue.c | 2 +- kapi-compat/include/register_sysctl.h | 6 ++++++ 5 files changed, 18 insertions(+), 2 deletions(-) create mode 100644 kapi-compat/include/register_sysctl.h
Makefile +2 -1
@@ -21,7 +21,8 @@ KAPI_COMPAT_FILES = \ kapi-compat/include/aiovec.h \ kapi-compat/include/mandatory_lock.h \ kapi-compat/include/fsuid.h \ - kapi-compat/include/umh_wait.h + kapi-compat/include/umh_wait.h \ + kapi-compat/include/register_sysctl.h PATCH_FILES =
configure.in +5 -0
@@ -318,6 +318,11 @@ OCFS2_CHECK_KERNEL([enum umh_wait in kmod.h], kmod.h, , kmod_compat_header=umh_wait.h, [enum umh_wait {]) KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS $kmod_compat_header" +old_register_sysctl= +OCFS2_CHECK_KERNEL([register_sysctl_table() has one arg in sysctl.h], sysctl.h, + , old_register_sysctl=register_sysctl.h, [^struct ctl_table_header \*register_sysctl_table(struct ctl_table \* table);]) +KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS $old_register_sysctl" + # End kapi_compat checks # using -include has two advantages:
fs/ocfs2/kapi-default.h +4 -0
@@ -46,4 +46,8 @@ typedef u64 f_version_t;# define ocfs2_file_aio_write __ocfs2_file_aio_write#endif +#ifndef kapi_register_sysctl_table +# define kapi_register_sysctl_table (a) register_sysctl_table(a) +#endif +#endif
fs/ocfs2/stackglue.c +1 -1
@@ -678,7 +678,7 @@ static int __init ocfs2_stack_glue_init(void) {strcpy (cluster_stack_name,OCFS2_STACK_PLUGIN_O2CB ); - ocfs2_table_header =register_sysctl_table (ocfs2_root_table); + ocfs2_table_header =kapi_register_sysctl_table (ocfs2_root_table);if (!ocfs2_table_header) {printk (KERN_ERR "ocfs2 stack glue: unable to register sysctl\n" );
kapi-compat/include/register_sysctl.h new file +6 -0
@@ -0,0 +1,6 @@ +#ifndef KAPI_REGISTER_SYSCTL_H +#define KAPI_REGISTER_SYSCTL_H + +#define kapi_register_sysctl_table (a) register_sysctl_table(a, 0) + +#endif
Signature · 1 line
1.5.6.5
PATCH 8/8 ocfs2: Handle missing enum value FS_OCFS2
In reply to Sunil MushranMainline commit 0e03036c97b70b2602f7dedaa3a223ed7563c2c9 added enum FS_OCFS2.
--- Makefile | 3 ++- configure.in | 5 +++++ kapi-compat/include/sysctl.h | 9 +++++++++ 3 files changed, 16 insertions(+), 1 deletions(-) create mode 100644 kapi-compat/include/sysctl.h
Makefile +2 -1
@@ -22,7 +22,8 @@ KAPI_COMPAT_FILES = \ kapi-compat/include/mandatory_lock.h \ kapi-compat/include/fsuid.h \ kapi-compat/include/umh_wait.h \ - kapi-compat/include/register_sysctl.h + kapi-compat/include/register_sysctl.h \ + kapi-compat/include/sysctl.h PATCH_FILES =
configure.in +5 -0
@@ -323,6 +323,11 @@ OCFS2_CHECK_KERNEL([register_sysctl_table() has one arg in sysctl.h], sysctl.h, , old_register_sysctl=register_sysctl.h, [^struct ctl_table_header \*register_sysctl_table(struct ctl_table \* table);]) KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS $old_register_sysctl" +sysctl_compat_header= +OCFS2_CHECK_KERNEL([enum FS_OCFS2 in sysctl.h], sysctl.h, + , sysctl_compat_header=sysctl.h, [FS_OCFS2=]) +KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS $sysctl_compat_header" + # End kapi_compat checks # using -include has two advantages:
kapi-compat/include/sysctl.h new file +9 -0
@@ -0,0 +1,9 @@ +#ifndef KAPI_SYSCTL_H +#define KAPI_SYSCTL_H + +/* CTL_FS names: */ +enum { +FS_OCFS2 =988 ,/* ocfs2 */ +}; + +#endif
Signature · 1 line
1.5.6.5
Quoted 1 line · Sunil Mushran
The next set. The previous 3 sets have been pushed to the git repo.
Ack.
Joel
Signature · 7 lines
f/8 and be there. Joel Becker Principal Software Developer Oracle E-mail: joel.becker at oracle.com Phone: (650) 506-8127