Skip to contentSkip to conversation

ocfs2-1.6 - fifth set

Ocfs2-devel New Sunil Mushran 2 participants 22 messages Nov 13, 2009

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

The next set. All patches prior to this have been pushed to the repo.

#1 lore raw

PATCH 1/18 ocfs2: Add kapi-default.h in cluster and dlm

Commit 19582597eec08f61b6f5794c15f6f2c9821a67d9 added kapi-default.h in fs/ocfs2. This patch adds a similar named file in fs/ocfs2/cluster and fs/ocfs2/dlm to allow building against the mainline without kapi-compat headers.

---
 fs/ocfs2/cluster/Makefile       |    2 +-
 fs/ocfs2/cluster/kapi-default.h |   26 ++++++++++++++++++++++++++
 fs/ocfs2/dlm/Makefile           |    2 +-
 fs/ocfs2/dlm/kapi-default.h     |   26 ++++++++++++++++++++++++++
 4 files changed, 54 insertions(+), 2 deletions(-)
 create mode 100644 fs/ocfs2/cluster/kapi-default.h
 create mode 100644 fs/ocfs2/dlm/kapi-default.h
fs/ocfs2/cluster/Makefile +1 -1
index d89112d..1f040c6 100644
@@ -12,7 +12,7 @@ include $(OUR_TOPDIR)/Config.make
 endif
 
 COMPAT_SOURCES =
-COMPAT_HEADERS =
+COMPAT_HEADERS = kapi-default.h
 SOURCES =
 HEADERS =
 
fs/ocfs2/cluster/kapi-default.h new file +26 -0
new file mode 100644
index 0000000..fcf3ac9
@@ -0,0 +1,26 @@
+/* -*- mode: c; c-basic-offset: 8; -*-
+ * vim: noexpandtab sw=8 ts=8 sts=0:
+ *
+ * kapi-default.h
+ *
+ * Defines kapi-compat macros and structures used in OCFS2
+ *
+ * Copyright (C) 2009 Oracle.  All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ */
+
+#ifndef KAPI_DEFAULT_H
+#define KAPI_DEFAULT_H
+
+
+#endif
fs/ocfs2/dlm/Makefile +1 -1
index 122b370..0c4d1f4 100644
@@ -13,7 +13,7 @@ include $(OUR_TOPDIR)/Config.make
 endif
 
 COMPAT_SOURCES =
-COMPAT_HEADERS =
+COMPAT_HEADERS = kapi-default.h
 DLM_SOURCES =
 DLMFS_SOURCES =
 HEADERS =
fs/ocfs2/dlm/kapi-default.h new file +26 -0
new file mode 100644
index 0000000..fcf3ac9
@@ -0,0 +1,26 @@
+/* -*- mode: c; c-basic-offset: 8; -*-
+ * vim: noexpandtab sw=8 ts=8 sts=0:
+ *
+ * kapi-default.h
+ *
+ * Defines kapi-compat macros and structures used in OCFS2
+ *
+ * Copyright (C) 2009 Oracle.  All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ */
+
+#ifndef KAPI_DEFAULT_H
+#define KAPI_DEFAULT_H
+
+
+#endif
Signature · 1 line
1.5.6.5
#2 lore raw

PATCH 2/18 ocfs2: Add KAPI_INIT_WORK macro in kapi-default.h

In reply to Sunil Mushran

Commit dbc80b8f391820b719db97004219327c8cf050bc added KAPI_INIT_WORK macros to fs/ocfs2/kapi-default.h. This patch adds the same to the same header in dlm and cluster sub-directories.

---
 fs/ocfs2/cluster/kapi-default.h |    6 ++++++
 fs/ocfs2/dlm/kapi-default.h     |    6 ++++++
 2 files changed, 12 insertions(+), 0 deletions(-)
fs/ocfs2/cluster/kapi-default.h +6 -0
index fcf3ac9..21e5e3a 100644
@@ -22,5 +22,11 @@
 #ifndef KAPI_DEFAULT_H
 #define KAPI_DEFAULT_H
 
+#ifndef KAPI_INIT_WORK
+typedef struct work_struct kapi_work_struct_t;
+# define work_to_object(a, b, c)		container_of(a, b, c)
+# define KAPI_INIT_WORK(a, b, c)		INIT_WORK(a, b)
+# define KAPI_INIT_DELAYED_WORK(a, b, c)	INIT_DELAYED_WORK(a, b)
+#endif
 
 #endif
fs/ocfs2/dlm/kapi-default.h +6 -0
index fcf3ac9..21e5e3a 100644
@@ -22,5 +22,11 @@
 #ifndef KAPI_DEFAULT_H
 #define KAPI_DEFAULT_H
 
+#ifndef KAPI_INIT_WORK
+typedef struct work_struct kapi_work_struct_t;
+# define work_to_object(a, b, c)		container_of(a, b, c)
+# define KAPI_INIT_WORK(a, b, c)		INIT_WORK(a, b)
+# define KAPI_INIT_DELAYED_WORK(a, b, c)	INIT_DELAYED_WORK(a, b)
+#endif
 
 #endif
Signature · 1 line
1.5.6.5
#3 lore raw

PATCH 3/18 ocfs2: Handle missing dtor in kmem_cache_create()

In reply to Sunil Mushran

Mainline commit 20c2df83d25c6a95affe6157a4c9cac4cf5ffaac removed the dtor arg from kmem_cache_create(). Patch adds a kapi macro that adds a dtor arg when building against EL5 kernels.

---
 Config.make.in              |    1 +
 Makefile                    |    3 ++-
 configure.in                |    6 ++++++
 fs/ocfs2/Makefile           |    4 ++++
 fs/ocfs2/dlm/Makefile       |    4 ++++
 fs/ocfs2/dlm/dlmfs.c        |    7 ++++++-
 fs/ocfs2/dlm/dlmlock.c      |    2 +-
 fs/ocfs2/dlm/dlmmaster.c    |    6 +++---
 fs/ocfs2/dlm/kapi-default.h |    4 ++++
 fs/ocfs2/kapi-default.h     |    4 ++++
 fs/ocfs2/super.c            |   11 ++++++++---
 fs/ocfs2/uptodate.c         |    2 +-
 kapi-compat/include/slab.h  |    8 ++++++++
 13 files changed, 52 insertions(+), 10 deletions(-)
 create mode 100644 kapi-compat/include/slab.h
Config.make.in +1 -0
index a19d096..fb705b5 100644
@@ -72,6 +72,7 @@ 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@
+KMEM_CACHE_CREATE_DTOR = @KMEM_CACHE_CREATE_DTOR@
 
 
 OCFS_DEBUG = @OCFS_DEBUG@
Makefile +2 -1
index adaf9fb..912fb70 100644
@@ -23,7 +23,8 @@ KAPI_COMPAT_FILES = \
 	kapi-compat/include/fsuid.h			\
 	kapi-compat/include/umh_wait.h			\
 	kapi-compat/include/register_sysctl.h		\
-	kapi-compat/include/sysctl.h
+	kapi-compat/include/sysctl.h			\
+	kapi-compat/include/slab.h
 
 PATCH_FILES =
 
configure.in +6 -0
index b662f88..98cdc5d 100644
@@ -328,6 +328,12 @@ 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"
 
+KMEM_CACHE_CREATE_DTOR=
+OCFS2_CHECK_KERNEL([	older prototype of kmem_cache_create() in slab.h], slab.h,
+  KMEM_CACHE_CREATE_DTOR=slab.h, , [^.*void (\*)(void \*, kmem_cache_t \*, unsigned long),])
+AC_SUBST(KMEM_CACHE_CREATE_DTOR)
+KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS $KMEM_CACHE_CREATE_DTOR"
+
 # End kapi_compat checks
 
 # using -include has two advantages:
fs/ocfs2/Makefile +4 -0
index 32d864d..c769fd8 100644
@@ -92,6 +92,10 @@ ifdef OLD_PERMISSION
 EXTRA_CFLAGS += -DOLD_PERMISSION
 endif
 
+ifdef KMEM_CACHE_CREATE_DTOR
+EXTRA_CFLAGS += -DKMEM_CACHE_CREATE_DTOR
+endif
+
 #
 # Since SUBDIRS means something to kbuild, define them safely.  Do not
 # include trailing slashes.
fs/ocfs2/dlm/Makefile +4 -0
index 0c4d1f4..907e390 100644
@@ -42,6 +42,10 @@ ifdef SEQOP_IS_NOT_CONST
 EXTRA_CFLAGS += -DSEQOP_IS_NOT_CONST
 endif
 
+ifdef KMEM_CACHE_CREATE_DTOR
+EXTRA_CFLAGS += -DKMEM_CACHE_CREATE_DTOR
+endif
+
 DLM_SOURCES +=			\
 	dlmast.c		\
 	dlmconvert.c		\
fs/ocfs2/dlm/dlmfs.c +6 -1
index d05653d..6d97173 100644
@@ -277,7 +277,12 @@ static ssize_t dlmfs_file_write(struct file *filp,
 	return writelen;
 }
 
+#ifdef KMEM_CACHE_CREATE_DTOR
+static void dlmfs_init_once(void *foo, struct kmem_cache *cachep,
+			    unsigned long flags)
+#else
 static void dlmfs_init_once(void *foo)
+#endif
 {
 	struct dlmfs_inode_private *ip =
 		(struct dlmfs_inode_private *) foo;
@@ -628,7 +633,7 @@ static int __init init_dlmfs_fs(void)
 	if (status)
 		return status;
 
-	dlmfs_inode_cache = kmem_cache_create("dlmfs_inode_cache",
+	dlmfs_inode_cache = kapi_kmem_cache_create("dlmfs_inode_cache",
 				sizeof(struct dlmfs_inode_private),
 				0, (SLAB_HWCACHE_ALIGN|SLAB_RECLAIM_ACCOUNT|
 					SLAB_MEM_SPREAD),
fs/ocfs2/dlm/dlmlock.c +1 -1
index 437698e..98840f9 100644
@@ -67,7 +67,7 @@ static void dlm_lock_detach_lockres(struct dlm_lock *lock);
 
 int dlm_init_lock_cache(void)
 {
-	dlm_lock_cache = kmem_cache_create("o2dlm_lock",
+	dlm_lock_cache = kapi_kmem_cache_create("o2dlm_lock",
 					   sizeof(struct dlm_lock),
 					   0, SLAB_HWCACHE_ALIGN, NULL);
 	if (dlm_lock_cache == NULL)
fs/ocfs2/dlm/dlmmaster.c +3 -3
index 83bcaf2..90d3157 100644
@@ -406,7 +406,7 @@ static void dlm_mle_node_up(struct dlm_ctxt *dlm,
 
 int dlm_init_mle_cache(void)
 {
-	dlm_mle_cache = kmem_cache_create("o2dlm_mle",
+	dlm_mle_cache = kapi_kmem_cache_create("o2dlm_mle",
 					  sizeof(struct dlm_master_list_entry),
 					  0, SLAB_HWCACHE_ALIGN,
 					  NULL);
@@ -457,13 +457,13 @@ static void dlm_mle_release(struct kref *kref)
 
 int dlm_init_master_caches(void)
 {
-	dlm_lockres_cache = kmem_cache_create("o2dlm_lockres",
+	dlm_lockres_cache = kapi_kmem_cache_create("o2dlm_lockres",
 					      sizeof(struct dlm_lock_resource),
 					      0, SLAB_HWCACHE_ALIGN, NULL);
 	if (!dlm_lockres_cache)
 		goto bail;
 
-	dlm_lockname_cache = kmem_cache_create("o2dlm_lockname",
+	dlm_lockname_cache = kapi_kmem_cache_create("o2dlm_lockname",
 					       DLM_LOCKID_NAME_MAX, 0,
 					       SLAB_HWCACHE_ALIGN, NULL);
 	if (!dlm_lockname_cache)
fs/ocfs2/dlm/kapi-default.h +4 -0
index 21e5e3a..bcdb486 100644
@@ -29,4 +29,8 @@ typedef struct work_struct kapi_work_struct_t;
 # define KAPI_INIT_DELAYED_WORK(a, b, c)	INIT_DELAYED_WORK(a, b)
 #endif
 
+#ifndef kapi_kmem_cache_create
+# define kapi_kmem_cache_create(a, b, c, d, e)	kmem_cache_create(a, b, c, d, e)
+#endif
+
 #endif
fs/ocfs2/kapi-default.h +4 -0
index 7489a19..2f60b87 100644
@@ -50,4 +50,8 @@ typedef u64 f_version_t;
 # define kapi_register_sysctl_table(a)	register_sysctl_table(a)
 #endif
 
+#ifndef kapi_kmem_cache_create
+# define kapi_kmem_cache_create(a, b, c, d, e)	kmem_cache_create(a, b, c, d, e)
+#endif
+
 #endif
fs/ocfs2/super.c +8 -3
index bee2c31..e36bec2 100644
@@ -1671,7 +1671,12 @@ bail:
 	return status;
 }
 
+#ifdef KMEM_CACHE_CREATE_DTOR
+static void ocfs2_inode_init_once(void *data, struct kmem_cache *cachep,
+				  unsigned long flags)
+#else
 static void ocfs2_inode_init_once(void *data)
+#endif
 {
 	struct ocfs2_inode_info *oi = data;
 
@@ -1701,19 +1706,19 @@ static void ocfs2_inode_init_once(void *data)
 
 static int ocfs2_initialize_mem_caches(void)
 {
-	ocfs2_inode_cachep = kmem_cache_create("ocfs2_inode_cache",
+	ocfs2_inode_cachep = kapi_kmem_cache_create("ocfs2_inode_cache",
 				       sizeof(struct ocfs2_inode_info),
 				       0,
 				       (SLAB_HWCACHE_ALIGN|SLAB_RECLAIM_ACCOUNT|
 						SLAB_MEM_SPREAD),
 				       ocfs2_inode_init_once);
-	ocfs2_dquot_cachep = kmem_cache_create("ocfs2_dquot_cache",
+	ocfs2_dquot_cachep = kapi_kmem_cache_create("ocfs2_dquot_cache",
 					sizeof(struct ocfs2_dquot),
 					0,
 					(SLAB_HWCACHE_ALIGN|SLAB_RECLAIM_ACCOUNT|
 						SLAB_MEM_SPREAD),
 					NULL);
-	ocfs2_qf_chunk_cachep = kmem_cache_create("ocfs2_qf_chunk_cache",
+	ocfs2_qf_chunk_cachep = kapi_kmem_cache_create("ocfs2_qf_chunk_cache",
 					sizeof(struct ocfs2_quota_chunk),
 					0,
 					(SLAB_RECLAIM_ACCOUNT|SLAB_MEM_SPREAD),
fs/ocfs2/uptodate.c +1 -1
index b6284f2..fe57890 100644
@@ -625,7 +625,7 @@ void ocfs2_remove_xattr_clusters_from_cache(struct ocfs2_caching_info *ci,
 
 int __init init_ocfs2_uptodate_cache(void)
 {
-	ocfs2_uptodate_cachep = kmem_cache_create("ocfs2_uptodate",
+	ocfs2_uptodate_cachep = kapi_kmem_cache_create("ocfs2_uptodate",
 				  sizeof(struct ocfs2_meta_cache_item),
 				  0, SLAB_HWCACHE_ALIGN, NULL);
 	if (!ocfs2_uptodate_cachep)
kapi-compat/include/slab.h new file +8 -0
new file mode 100644
index 0000000..c682289
@@ -0,0 +1,8 @@
+#ifndef KAPI_SLAB_H
+#define KAPI_SLAB_H
+
+#ifdef KMEM_CACHE_CREATE_DTOR
+# define kapi_kmem_cache_create(a, b, c, d, e)	kmem_cache_create(a, b, c, d, e, NULL)
+#endif
+
+#endif
Signature · 1 line
1.5.6.5
#4 lore raw

PATCH 3/18 ocfs2: Handle missing dtor in kmem_cache_create()

Quoted 3 lines · Sunil Mushran

Mainline commit 20c2df83d25c6a95affe6157a4c9cac4cf5ffaac removed the dtor arg from kmem_cache_create(). Patch adds a kapi macro that adds a dtor arg when building against EL5 kernels.

Question: Do you want to support an assortment of mainline
kernels, or only "2.6.32" and "2.6.18-el"? Because there are a number of slab things that happened. I'm not sure which all apply to el5 anymore. Not only did the destructor go away, so did the flag SLAB_CTOR_VERIFY, and the init_once constructors changed prototype.
Here was my solution:

http://oss.oracle.com/git/oracleasm.git/?p=oracleasm.git;a=commit;h=0888fd1be3d15ab3c7f504c8969c101f7d5d39fd

(Note that there are a couple of later commits to fix typos)

Joel

Signature · 9 lines
Life's Little Instruction Book #182

	"Be romantic."

Joel Becker
Principal Software Developer
Oracle
E-mail: joel.becker at oracle.com
Phone: (650) 506-8127
#5 lore raw

PATCH 3/18 ocfs2: Handle missing dtor in kmem_cache_create()

Quoted 14 lines · Joel Becker
Quoted 4 lines · Sunil Mushran

Mainline commit 20c2df83d25c6a95affe6157a4c9cac4cf5ffaac removed the dtor arg from kmem_cache_create(). Patch adds a kapi macro that adds a dtor arg when building against EL5 kernels.

Question: Do you want to support an assortment of mainline
kernels, or only "2.6.32" and "2.6.18-el"? Because there are a number of slab things that happened. I'm not sure which all apply to el5 anymore. Not only did the destructor go away, so did the flag SLAB_CTOR_VERIFY, and the init_once constructors changed prototype.
Here was my solution:

Quoted 4 lines

http://oss.oracle.com/git/oracleasm.git/?p=oracleasm.git;a=commit;h=0888fd1be3d15ab3c7f504c8969c101f7d5d39fd

(Note that there are a couple of later commits to fix typos)

Only EL5 U4. The idea is to be able to able to build against 2.6.32. But we only support running against EL5 U4.

#6 lore raw

PATCH 4/18 ocfs2/cluster: Handle different prototype of bi_end_io_t

In reply to Sunil Mushran

Mainline commit 6712ecf8f648118c3363c142196418f89a510b90 dropped the 'size' argument from bi_end_io_t. Also changed the return from int to void. Patch uses the older prototype when building with EL5 kernels.

---
 Config.make.in               |    1 +
 configure.in                 |    5 +++++
 fs/ocfs2/cluster/Makefile    |    4 ++++
 fs/ocfs2/cluster/heartbeat.c |    7 +++++++
 4 files changed, 17 insertions(+), 0 deletions(-)
Config.make.in +1 -0
index fb705b5..618c814 100644
@@ -73,6 +73,7 @@ SEQOP_IS_NOT_CONST = @SEQOP_IS_NOT_CONST@
 NO_VECTORIZED_AIO = @NO_VECTORIZED_AIO@
 OLD_PERMISSION = @OLD_PERMISSION@
 KMEM_CACHE_CREATE_DTOR = @KMEM_CACHE_CREATE_DTOR@
+OLD_BIO_END_IO_T = @OLD_BIO_END_IO_T@
 
 
 OCFS_DEBUG = @OCFS_DEBUG@
configure.in +5 -0
index 98cdc5d..8696935 100644
@@ -334,6 +334,11 @@ OCFS2_CHECK_KERNEL([	older prototype of kmem_cache_create() in slab.h], slab.h,
 AC_SUBST(KMEM_CACHE_CREATE_DTOR)
 KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS $KMEM_CACHE_CREATE_DTOR"
 
+OLD_BIO_END_IO_T=
+OCFS2_CHECK_KERNEL([	older prototype of bio_end_io_t in bio.h], bio.h,
+  OLD_BIO_END_IO_T=yes, , [^typedef int (bio_end_io_t) (struct bio \*, unsigned int, int);])
+AC_SUBST(OLD_BIO_END_IO_T)
+
 # End kapi_compat checks
 
 # using -include has two advantages:
fs/ocfs2/cluster/Makefile +4 -0
index 1f040c6..d107cca 100644
@@ -26,6 +26,10 @@ ifdef SEQOP_IS_NOT_CONST
 EXTRA_CFLAGS += -DSEQOP_IS_NOT_CONST
 endif
 
+ifdef OLD_BIO_END_IO_T
+EXTRA_CFLAGS += -DOLD_BIO_END_IO_T
+endif
+
 SOURCES +=			\
 	heartbeat.c		\
 	masklog.c		\
fs/ocfs2/cluster/heartbeat.c +7 -0
index 68e9af5..d07241f 100644
@@ -221,7 +221,11 @@ static void o2hb_wait_on_io(struct o2hb_region *reg,
 	wait_for_completion(&wc->wc_io_complete);
 }
 
+#ifdef OLD_BIO_END_IO_T
+static int o2hb_bio_end_io(struct bio *bio, unsigned int size,
+#else
 static void o2hb_bio_end_io(struct bio *bio,
+#endif
 			   int error)
 {
 	struct o2hb_bio_wait_ctxt *wc = bio->bi_private;
@@ -233,6 +237,9 @@ static void o2hb_bio_end_io(struct bio *bio,
 
 	o2hb_bio_wait_dec(wc, 1);
 	bio_put(bio);
+#ifdef OLD_BIO_END_IO_T
+	return 0;
+#endif
 }
 
 /* Setup a Bio to cover I/O against num_slots slots starting at
Signature · 1 line
1.5.6.5
#7 lore raw

PATCH 5/18 ocfs2: Handle missing fmode_t in blkdev_put()

In reply to Sunil Mushran

Mainline commit 9a1c3542768b5a58e45a9216921cd10a3bae1205 added arg fmode_t to blkdev_put(). Patch allows building against EL5 by ignoring that argument.

---
 Makefile                         |    3 ++-
 configure.in                     |    5 +++++
 fs/ocfs2/cluster/heartbeat.c     |    4 ++--
 fs/ocfs2/cluster/kapi-default.h  |    4 ++++
 kapi-compat/include/blkdev_put.h |    6 ++++++
 5 files changed, 19 insertions(+), 3 deletions(-)
 create mode 100644 kapi-compat/include/blkdev_put.h
Makefile +2 -1
index 912fb70..a94d345 100644
@@ -24,7 +24,8 @@ KAPI_COMPAT_FILES = \
 	kapi-compat/include/umh_wait.h			\
 	kapi-compat/include/register_sysctl.h		\
 	kapi-compat/include/sysctl.h			\
-	kapi-compat/include/slab.h
+	kapi-compat/include/slab.h			\
+	kapi-compat/include/blkdev_put.h
 
 PATCH_FILES =
 
configure.in +5 -0
index 8696935..6c93e2f 100644
@@ -339,6 +339,11 @@ OCFS2_CHECK_KERNEL([	older prototype of bio_end_io_t in bio.h], bio.h,
   OLD_BIO_END_IO_T=yes, , [^typedef int (bio_end_io_t) (struct bio \*, unsigned int, int);])
 AC_SUBST(OLD_BIO_END_IO_T)
 
+blkdev_put_header=
+OCFS2_CHECK_KERNEL([	older prototype of blkdev_put() in fs.h], fs.h,
+  blkdev_put_header=blkdev_put.h, , [^extern int blkdev_put(struct block_device \*);])
+KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS $blkdev_put_header"
+
 # End kapi_compat checks
 
 # using -include has two advantages:
fs/ocfs2/cluster/heartbeat.c +2 -2
index d07241f..ed05786 100644
@@ -1076,7 +1076,7 @@ static void o2hb_region_release(struct config_item *item)
 	}
 
 	if (reg->hr_bdev)
-		blkdev_put(reg->hr_bdev, FMODE_READ|FMODE_WRITE);
+		kapi_blkdev_put(reg->hr_bdev, FMODE_READ|FMODE_WRITE);
 
 	if (reg->hr_slots)
 		kfree(reg->hr_slots);
@@ -1459,7 +1459,7 @@ out:
 		iput(inode);
 	if (ret < 0) {
 		if (reg->hr_bdev) {
-			blkdev_put(reg->hr_bdev, FMODE_READ|FMODE_WRITE);
+			kapi_blkdev_put(reg->hr_bdev, FMODE_READ|FMODE_WRITE);
 			reg->hr_bdev = NULL;
 		}
 	}
fs/ocfs2/cluster/kapi-default.h +4 -0
index 21e5e3a..ded908a 100644
@@ -29,4 +29,8 @@ typedef struct work_struct kapi_work_struct_t;
 # define KAPI_INIT_DELAYED_WORK(a, b, c)	INIT_DELAYED_WORK(a, b)
 #endif
 
+#ifndef kapi_blkdev_put
+# define kapi_blkdev_put		blkdev_put
+#endif
+
 #endif
kapi-compat/include/blkdev_put.h new file +6 -0
new file mode 100644
index 0000000..cf30192
@@ -0,0 +1,6 @@
+#ifndef KAPI_BLKDEV_PUT_H
+#define KAPI_BLKDEV_PUT_H
+
+#define kapi_blkdev_put(a, b)	blkdev_put(a)
+
+#endif
Signature · 1 line
1.5.6.5
#8 lore raw

PATCH 6/18 ocfs2: Handle older prototype of blkdev_get()

In reply to Sunil Mushran

Mainline commit 572c48921574dbe6dceb958cf965aa962baefde4 removed the flags argument in blkdev_get(). Patch allows building against EL5 by forcing a 0 in place of that argument. This is ok as we are not using that argument.

---
 Makefile                         |    3 ++-
 configure.in                     |    5 +++++
 fs/ocfs2/cluster/heartbeat.c     |    2 +-
 fs/ocfs2/cluster/kapi-default.h  |    4 ++++
 kapi-compat/include/blkdev_get.h |    6 ++++++
 5 files changed, 18 insertions(+), 2 deletions(-)
 create mode 100644 kapi-compat/include/blkdev_get.h
Makefile +2 -1
index a94d345..5e1bb62 100644
@@ -25,7 +25,8 @@ KAPI_COMPAT_FILES = \
 	kapi-compat/include/register_sysctl.h		\
 	kapi-compat/include/sysctl.h			\
 	kapi-compat/include/slab.h			\
-	kapi-compat/include/blkdev_put.h
+	kapi-compat/include/blkdev_put.h		\
+	kapi-compat/include/blkdev_get.h
 
 PATCH_FILES =
 
configure.in +5 -0
index 6c93e2f..8ce5e67 100644
@@ -344,6 +344,11 @@ OCFS2_CHECK_KERNEL([	older prototype of blkdev_put() in fs.h], fs.h,
   blkdev_put_header=blkdev_put.h, , [^extern int blkdev_put(struct block_device \*);])
 KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS $blkdev_put_header"
 
+blkdev_get_header=
+OCFS2_CHECK_KERNEL([	older prototype of blkdev_get() in fs.h], fs.h,
+  blkdev_get_header=blkdev_get.h, , [^extern int blkdev_get(struct block_device \*, mode_t, unsigned);])
+KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS $blkdev_get_header"
+
 # End kapi_compat checks
 
 # using -include has two advantages:
fs/ocfs2/cluster/heartbeat.c +1 -1
index ed05786..3d3e306 100644
@@ -1368,7 +1368,7 @@ static ssize_t o2hb_region_dev_write(struct o2hb_region *reg,
 		goto out;
 
 	reg->hr_bdev = I_BDEV(filp->f_mapping->host);
-	ret = blkdev_get(reg->hr_bdev, FMODE_WRITE | FMODE_READ);
+	ret = kapi_blkdev_get(reg->hr_bdev, FMODE_WRITE | FMODE_READ);
 	if (ret) {
 		reg->hr_bdev = NULL;
 		goto out;
fs/ocfs2/cluster/kapi-default.h +4 -0
index ded908a..fc3da05 100644
@@ -33,4 +33,8 @@ typedef struct work_struct kapi_work_struct_t;
 # define kapi_blkdev_put		blkdev_put
 #endif
 
+#ifndef kapi_blkdev_get
+# define kapi_blkdev_get		blkdev_get
+#endif
+
 #endif
kapi-compat/include/blkdev_get.h new file +6 -0
new file mode 100644
index 0000000..dcf7425
@@ -0,0 +1,6 @@
+#ifndef KAPI_BLKDEV_GET_H
+#define KAPI_BLKDEV_GET_H
+
+#define kapi_blkdev_get(a, b)	blkdev_get(a, b, 0)
+
+#endif
Signature · 1 line
1.5.6.5
#9 lore raw

PATCH 7/18 ocfs2: Handles missing configfs_depend_item() and configfs_undepend_item()

In reply to Sunil Mushran

Mainline commit 631d1febab8e546e3bb800bdfe2c212b8adf87de added configfs_depend_item() and configfs_undepend_item(). Patch adds empty macros when building against EL5 that does not have the functionality.

---
 Makefile                       |    3 ++-
 configure.in                   |    5 +++++
 kapi-compat/include/configfs.h |    7 +++++++
 3 files changed, 14 insertions(+), 1 deletions(-)
 create mode 100644 kapi-compat/include/configfs.h
Makefile +2 -1
index 5e1bb62..00535ff 100644
@@ -26,7 +26,8 @@ KAPI_COMPAT_FILES = \
 	kapi-compat/include/sysctl.h			\
 	kapi-compat/include/slab.h			\
 	kapi-compat/include/blkdev_put.h		\
-	kapi-compat/include/blkdev_get.h
+	kapi-compat/include/blkdev_get.h		\
+	kapi-compat/include/configfs.h
 
 PATCH_FILES =
 
configure.in +5 -0
index 8ce5e67..aad0ea1 100644
@@ -349,6 +349,11 @@ OCFS2_CHECK_KERNEL([	older prototype of blkdev_get() in fs.h], fs.h,
   blkdev_get_header=blkdev_get.h, , [^extern int blkdev_get(struct block_device \*, mode_t, unsigned);])
 KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS $blkdev_get_header"
 
+configfs_compat_header=
+OCFS2_CHECK_KERNEL([configfs_depend_item() in configfs.h], configfs.h,
+  , configfs_compat_header=configfs.h, [^int configfs_depend_item(])
+KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS $configfs_compat_header"
+
 # End kapi_compat checks
 
 # using -include has two advantages:
kapi-compat/include/configfs.h new file +7 -0
new file mode 100644
index 0000000..cbc11e6
@@ -0,0 +1,7 @@
+#ifndef KAPI_CONFIGFS_H
+#define KAPI_CONFIGFS_H
+
+#define configfs_depend_item(a, b)	(0)
+#define configfs_undepend_item(a, b)
+
+#endif
Signature · 1 line
1.5.6.5
#10 lore raw

PATCH 8/18 ocfs2: Handle missing mutex in struct configfs_subsystem

In reply to Sunil Mushran

Mainline commit e6bd07aee739566803425acdbf5cdb29919164e1 changed a semaphore (su_sem) into a mutex (su_mutex) in struct configfs_subsystem. Patch adds macros to allow building with EL5.

---
 Makefile                        |    3 ++-
 configure.in                    |    5 +++++
 fs/ocfs2/cluster/kapi-default.h |    5 +++++
 fs/ocfs2/cluster/nodemanager.c  |    2 +-
 kapi-compat/include/su_mutex.h  |    9 +++++++++
 5 files changed, 22 insertions(+), 2 deletions(-)
 create mode 100644 kapi-compat/include/su_mutex.h
Makefile +2 -1
index 00535ff..623bda4 100644
@@ -27,7 +27,8 @@ KAPI_COMPAT_FILES = \
 	kapi-compat/include/slab.h			\
 	kapi-compat/include/blkdev_put.h		\
 	kapi-compat/include/blkdev_get.h		\
-	kapi-compat/include/configfs.h
+	kapi-compat/include/configfs.h			\
+	kapi-compat/include/su_mutex.h
 
 PATCH_FILES =
 
configure.in +5 -0
index aad0ea1..af32060 100644
@@ -354,6 +354,11 @@ OCFS2_CHECK_KERNEL([configfs_depend_item() in configfs.h], configfs.h,
   , configfs_compat_header=configfs.h, [^int configfs_depend_item(])
 KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS $configfs_compat_header"
 
+su_mutex_header=
+OCFS2_CHECK_KERNEL([su_mutex in struct configfs_subsystem in configfs.h], configfs.h,
+  , su_mutex_header=su_mutex.h, [struct mutex            su_mutex;])
+KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS $su_mutex_header"
+
 # End kapi_compat checks
 
 # using -include has two advantages:
fs/ocfs2/cluster/kapi-default.h +5 -0
index fc3da05..81dce2f 100644
@@ -37,4 +37,9 @@ typedef struct work_struct kapi_work_struct_t;
 # define kapi_blkdev_get		blkdev_get
 #endif
 
+#ifndef kapi_mutex_init
+# define kapi_mutex_init		mutex_init
+# define su_mutex			su_mutex
+#endif
+
 #endif
fs/ocfs2/cluster/nodemanager.c +1 -1
index 7ee6188..31140df 100644
@@ -903,7 +903,7 @@ static int __init init_o2nm(void)
 		goto out_o2net;
 
 	config_group_init(&o2nm_cluster_group.cs_subsys.su_group);
-	mutex_init(&o2nm_cluster_group.cs_subsys.su_mutex);
+	kapi_mutex_init(&o2nm_cluster_group.cs_subsys.su_mutex);
 	ret = configfs_register_subsystem(&o2nm_cluster_group.cs_subsys);
 	if (ret) {
 		printk(KERN_ERR "nodemanager: Registration returned %d\n", ret);
kapi-compat/include/su_mutex.h new file +9 -0
new file mode 100644
index 0000000..6713348
@@ -0,0 +1,9 @@
+#ifndef KAPI_SUMUTEX_H
+#define KAPI_SUMUTEX_H
+
+#include "asm/semaphore.h"
+
+#define kapi_mutex_init		init_MUTEX
+#define su_mutex		su_sem
+
+#endif
Signature · 1 line
1.5.6.5
#11 lore raw

PATCH 9/18 ocfs2: Handle missing helper kernel_sock_shutdown()

In reply to Sunil Mushran

Mainline commit 91cf45f02af5c871251165d000c3f42a2a0b0552 added helper kernel_sock_shutdown().

---
 Makefile                            |    3 ++-
 configure.in                        |    5 +++++
 kapi-compat/include/sock_shutdown.h |   17 +++++++++++++++++
 3 files changed, 24 insertions(+), 1 deletions(-)
 create mode 100644 kapi-compat/include/sock_shutdown.h
Makefile +2 -1
index 623bda4..0dd7443 100644
@@ -28,7 +28,8 @@ KAPI_COMPAT_FILES = \
 	kapi-compat/include/blkdev_put.h		\
 	kapi-compat/include/blkdev_get.h		\
 	kapi-compat/include/configfs.h			\
-	kapi-compat/include/su_mutex.h
+	kapi-compat/include/su_mutex.h			\
+	kapi-compat/include/sock_shutdown.h
 
 PATCH_FILES =
 
configure.in +5 -0
index af32060..e045fa8 100644
@@ -359,6 +359,11 @@ OCFS2_CHECK_KERNEL([su_mutex in struct configfs_subsystem in configfs.h], config
   , su_mutex_header=su_mutex.h, [struct mutex            su_mutex;])
 KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS $su_mutex_header"
 
+sock_shutdown_header=
+OCFS2_CHECK_KERNEL([kernel_sock_shutdown() in net.t], net.h,
+  , sock_shutdown_header=sock_shutdown.h, [^extern int kernel_sock_shutdown(struct socket \*sock])
+KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS $sock_shutdown_header"
+
 # End kapi_compat checks
 
 # using -include has two advantages:
kapi-compat/include/sock_shutdown.h new file +17 -0
new file mode 100644
index 0000000..83efccd
@@ -0,0 +1,17 @@
+#ifndef KAPI_SOCK_SHUTDOWN_H
+#define KAPI_SOCK_SHUTDOWN_H
+
+#include <linux/net.h>
+
+enum sock_shutdown_cmd {
+	SHUT_RD         = 0,
+	SHUT_WR         = 1,
+	SHUT_RDWR       = 2,
+};
+
+static inline int kernel_sock_shutdown(struct socket *sock, enum sock_shutdown_cmd how)
+{
+	return sock->ops->shutdown(sock, how);
+}
+
+#endif
Signature · 1 line
1.5.6.5
#12 lore raw

PATCH 10/18 ocfs2: Handle missing bdi_init()/bdi_destroy()

In reply to Sunil Mushran

Mainline commit e0bf68ddec4f4f90e5871404be4f1854c17f3120 added bdi_init() and bdi_destroy(). Patch adds empty inlines to allow building with EL5.

---
 Makefile                       |    3 ++-
 configure.in                   |    5 +++++
 kapi-compat/include/bdi_init.h |   14 ++++++++++++++
 3 files changed, 21 insertions(+), 1 deletions(-)
 create mode 100644 kapi-compat/include/bdi_init.h
Makefile +2 -1
index 0dd7443..68f746e 100644
@@ -29,7 +29,8 @@ KAPI_COMPAT_FILES = \
 	kapi-compat/include/blkdev_get.h		\
 	kapi-compat/include/configfs.h			\
 	kapi-compat/include/su_mutex.h			\
-	kapi-compat/include/sock_shutdown.h
+	kapi-compat/include/sock_shutdown.h		\
+	kapi-compat/include/bdi_init.h
 
 PATCH_FILES =
 
configure.in +5 -0
index e045fa8..53deffd 100644
@@ -364,6 +364,11 @@ OCFS2_CHECK_KERNEL([kernel_sock_shutdown() in net.t], net.h,
   , sock_shutdown_header=sock_shutdown.h, [^extern int kernel_sock_shutdown(struct socket \*sock])
 KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS $sock_shutdown_header"
 
+bdi_init_compat_header=
+OCFS2_CHECK_KERNEL([bdi_init() in backing-dev.h], backing-dev.h,
+  , bdi_init_compat_header=bdi_init.h, [^int bdi_init(struct backing_dev_info \*bdi);])
+KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS $bdi_init_compat_header"
+
 # End kapi_compat checks
 
 # using -include has two advantages:
kapi-compat/include/bdi_init.h new file +14 -0
new file mode 100644
index 0000000..2966533
@@ -0,0 +1,14 @@
+#ifndef KAPI_BDI_INIT_H
+#define KAPI_BDI_INIT_H
+
+static inline int bdi_init(struct backing_dev_info *bdi)
+{
+	return 0;
+}
+
+static inline void bdi_destroy(struct backing_dev_info *bdi)
+{
+	return ;
+}
+
+#endif
Signature · 1 line
1.5.6.5
#13 lore raw

PATCH 11/18 ocfs2: Handle missing BDI_CAP_NO_ACCT_AND_WRITEBACK

In reply to Sunil Mushran

Mainline commit e4ad08fe64afca4ef79ecc4c624e6e871688da0d added macro BDI_CAP_NO_ACCT_AND_WRITEBACK.

---
 Makefile                         |    3 ++-
 configure.in                     |    5 +++++
 kapi-compat/include/bdi_define.h |    6 ++++++
 3 files changed, 13 insertions(+), 1 deletions(-)
 create mode 100644 kapi-compat/include/bdi_define.h
Makefile +2 -1
index 68f746e..1cd2584 100644
@@ -30,7 +30,8 @@ KAPI_COMPAT_FILES = \
 	kapi-compat/include/configfs.h			\
 	kapi-compat/include/su_mutex.h			\
 	kapi-compat/include/sock_shutdown.h		\
-	kapi-compat/include/bdi_init.h
+	kapi-compat/include/bdi_init.h			\
+	kapi-compat/include/bdi_define.h
 
 PATCH_FILES =
 
configure.in +5 -0
index 53deffd..5fe4934 100644
@@ -369,6 +369,11 @@ OCFS2_CHECK_KERNEL([bdi_init() in backing-dev.h], backing-dev.h,
   , bdi_init_compat_header=bdi_init.h, [^int bdi_init(struct backing_dev_info \*bdi);])
 KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS $bdi_init_compat_header"
 
+bdi_define_compat_header=
+OCFS2_CHECK_KERNEL([BDI_CAP_NO_ACCT_AND_WRITEBACK in backing-dev.h], backing-dev.h,
+  , bdi_define_compat_header=bdi_define.h, [^#define BDI_CAP_NO_ACCT_AND_WRITEBACK])
+KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS $bdi_define_compat_header"
+
 # End kapi_compat checks
 
 # using -include has two advantages:
kapi-compat/include/bdi_define.h new file +6 -0
new file mode 100644
index 0000000..28de9da
@@ -0,0 +1,6 @@
+#ifndef KAPI_BDI_DEFINE_H
+#define KAPI_BDI_DEFINE_H
+
+#define BDI_CAP_NO_ACCT_AND_WRITEBACK	(BDI_CAP_NO_ACCT_DIRTY | BDI_CAP_NO_WRITEBACK)
+
+#endif
Signature · 1 line
1.5.6.5
#14 lore raw

PATCH 12/18 ocfs2: Handle missing vmops->fault()

In reply to Sunil Mushran

Mainline commit 54cb8821de07f2ffcd28c380ce9b93d5784b40d7 introduced vmops->fault() to replace vmops->populate() and vmops->nopage(). Patch adds nopage() and uses it when building against EL5.

---
 Config.make.in    |    1 +
 configure.in      |    5 ++++
 fs/ocfs2/Makefile |    4 +++
 fs/ocfs2/mmap.c   |   56 ++++++++++++++++++++++++++++++++++++++++++++++++++++-
 4 files changed, 65 insertions(+), 1 deletions(-)
Config.make.in +1 -0
index 618c814..a0330b9 100644
@@ -74,6 +74,7 @@ NO_VECTORIZED_AIO = @NO_VECTORIZED_AIO@
 OLD_PERMISSION = @OLD_PERMISSION@
 KMEM_CACHE_CREATE_DTOR = @KMEM_CACHE_CREATE_DTOR@
 OLD_BIO_END_IO_T = @OLD_BIO_END_IO_T@
+NO_FAULT_IN_VMOPS = @NO_FAULT_IN_VMOPS@
 
 
 OCFS_DEBUG = @OCFS_DEBUG@
configure.in +5 -0
index 5fe4934..a65ba15 100644
@@ -374,6 +374,11 @@ OCFS2_CHECK_KERNEL([BDI_CAP_NO_ACCT_AND_WRITEBACK in backing-dev.h], backing-dev
   , bdi_define_compat_header=bdi_define.h, [^#define BDI_CAP_NO_ACCT_AND_WRITEBACK])
 KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS $bdi_define_compat_header"
 
+NO_FAULT_IN_VMOPS=
+OCFS2_CHECK_KERNEL([fault() in struct vm_operations_struct in mm.h], mm.h,
+  , NO_FAULT_IN_VMOPS=yes, [^.*int (\*fault)])
+AC_SUBST(NO_FAULT_IN_VMOPS)
+
 # End kapi_compat checks
 
 # using -include has two advantages:
fs/ocfs2/Makefile +4 -0
index c769fd8..401a1f5 100644
@@ -96,6 +96,10 @@ ifdef KMEM_CACHE_CREATE_DTOR
 EXTRA_CFLAGS += -DKMEM_CACHE_CREATE_DTOR
 endif
 
+ifdef NO_FAULT_IN_VMOPS
+EXTRA_CFLAGS += -DNO_FAULT_IN_VMOPS
+endif
+
 #
 # Since SUBDIRS means something to kbuild, define them safely.  Do not
 # include trailing slashes.
fs/ocfs2/mmap.c +55 -1

116 lines not on this page · raw message

Signature · 1 line
1.5.6.5
#15 lore raw

PATCH 13/18 ocfs2: Handle missing inode_permission()

In reply to Sunil Mushran

Mainline commit f419a2e3b64def707e1384ee38abb77f99af5f6d renamed permission() to inode_permission(). Patch uses an inline to redirect inode_permission() to permission() when building with EL5.

---
 Makefile                               |    3 ++-
 configure.in                           |    5 +++++
 kapi-compat/include/inode_permission.h |   11 +++++++++++
 3 files changed, 18 insertions(+), 1 deletions(-)
 create mode 100644 kapi-compat/include/inode_permission.h
Makefile +2 -1
index 1cd2584..898879d 100644
@@ -31,7 +31,8 @@ KAPI_COMPAT_FILES = \
 	kapi-compat/include/su_mutex.h			\
 	kapi-compat/include/sock_shutdown.h		\
 	kapi-compat/include/bdi_init.h			\
-	kapi-compat/include/bdi_define.h
+	kapi-compat/include/bdi_define.h		\
+	kapi-compat/include/inode_permission.h
 
 PATCH_FILES =
 
configure.in +5 -0
index a65ba15..56315a6 100644
@@ -379,6 +379,11 @@ OCFS2_CHECK_KERNEL([fault() in struct vm_operations_struct in mm.h], mm.h,
   , NO_FAULT_IN_VMOPS=yes, [^.*int (\*fault)])
 AC_SUBST(NO_FAULT_IN_VMOPS)
 
+inode_permission_header=
+OCFS2_CHECK_KERNEL([inode_permision in fs.h], fs.h,
+  , inode_permission_header=inode_permission.h, [^extern int inode_permission(struct inode \*])
+KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS $inode_permission_header"
+
 # End kapi_compat checks
 
 # using -include has two advantages:
kapi-compat/include/inode_permission.h new file +11 -0
new file mode 100644
index 0000000..43f80d3
@@ -0,0 +1,11 @@
+#ifndef INODE_PERMISSION_H
+#define INODE_PERMISSION_H
+
+#include <linux/fs.h>
+
+static inline int inode_permission(struct inode *inode, int flags)
+{
+	return permission(inode, flags, NULL);
+}
+
+#endif
Signature · 1 line
1.5.6.5
#16 lore raw

PATCH 14/18 ocfs2: Handle older prototype of simple attribute get()

In reply to Sunil Mushran

Mainline commit 8b88b0998e35d239e74446cc30f354bdab86df89 changed prototype of simple attribute get() by returning the value via an argument. Patch detects older kernels and uses the older prototype that just return(ed) the value.

---
 Config.make.in        |    1 +
 configure.in          |    5 +++++
 fs/ocfs2/Makefile     |    4 ++++
 fs/ocfs2/blockcheck.c |    8 ++++++++
 4 files changed, 18 insertions(+), 0 deletions(-)
Config.make.in +1 -0
index a0330b9..355bf2a 100644
@@ -75,6 +75,7 @@ OLD_PERMISSION = @OLD_PERMISSION@
 KMEM_CACHE_CREATE_DTOR = @KMEM_CACHE_CREATE_DTOR@
 OLD_BIO_END_IO_T = @OLD_BIO_END_IO_T@
 NO_FAULT_IN_VMOPS = @NO_FAULT_IN_VMOPS@
+GET_RETURNS_U64_IN_SIMPLE_ATTR_OPEN = @GET_RETURNS_U64_IN_SIMPLE_ATTR_OPEN@
 
 
 OCFS_DEBUG = @OCFS_DEBUG@
configure.in +5 -0
index 56315a6..b8f1bd8 100644
@@ -384,6 +384,11 @@ OCFS2_CHECK_KERNEL([inode_permision in fs.h], fs.h,
   , inode_permission_header=inode_permission.h, [^extern int inode_permission(struct inode \*])
 KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS $inode_permission_header"
 
+GET_RETURNS_U64_IN_SIMPLE_ATTR_OPEN=
+OCFS2_CHECK_KERNEL([	get() return u64 in simple_attr_open() in fs.h], fs.h,
+ GET_RETURNS_U64_IN_SIMPLE_ATTR_OPEN=yes, , [u64 (\*get)(void \*), void (\*set)(void \*, u64),])
+AC_SUBST(GET_RETURNS_U64_IN_SIMPLE_ATTR_OPEN)
+
 # End kapi_compat checks
 
 # using -include has two advantages:
fs/ocfs2/Makefile +4 -0
index 401a1f5..6960f40 100644
@@ -100,6 +100,10 @@ ifdef NO_FAULT_IN_VMOPS
 EXTRA_CFLAGS += -DNO_FAULT_IN_VMOPS
 endif
 
+ifdef GET_RETURNS_U64_IN_SIMPLE_ATTR_OPEN
+EXTRA_CFLAGS += -DGET_RETURNS_U64_IN_SIMPLE_ATTR_OPEN
+endif
+
 #
 # Since SUBDIRS means something to kbuild, define them safely.  Do not
 # include trailing slashes.
fs/ocfs2/blockcheck.c +8 -0
index a1163b8..4927bf9 100644
@@ -232,11 +232,19 @@ void ocfs2_hamming_fix_block(void *data, unsigned int blocksize,
 
 #ifdef CONFIG_DEBUG_FS
 
+#ifdef GET_RETURNS_U64_IN_SIMPLE_ATTR_OPEN
+static u64 blockcheck_u64_get(void *data)
+{
+	return *(u64 *)data;
+}
+#else
 static int blockcheck_u64_get(void *data, u64 *val)
 {
 	*val = *(u64 *)data;
 	return 0;
 }
+#endif
+
 DEFINE_SIMPLE_ATTRIBUTE(blockcheck_fops, blockcheck_u64_get, NULL, "%llu\n");
 
 static struct dentry *blockcheck_debugfs_create(const char *name,
Signature · 1 line
1.5.6.5
#17 lore raw

PATCH 15/18 ocfs2: Handle missing export should_remove_suid()

In reply to Sunil Mushran

Mainline commit d23a147bb6e8d467e8df73b6589888717da3b9ce exported the symbol should_remove_suid(). Patch adds compat_should_remove_suid.c that includes the same function that gets built when building with EL5.

---
 Config.make.in                           |    1 +
 Makefile                                 |    3 +-
 configure.in                             |   10 +++++++
 fs/ocfs2/Makefile                        |    6 ++++
 fs/ocfs2/compat_should_remove_suid.c     |   40 ++++++++++++++++++++++++++++++
 kapi-compat/include/should_remove_suid.h |   12 +++++++++
 6 files changed, 71 insertions(+), 1 deletions(-)
 create mode 100644 fs/ocfs2/compat_should_remove_suid.c
 create mode 100644 kapi-compat/include/should_remove_suid.h
Config.make.in +1 -0
index 355bf2a..4b5f4c3 100644
@@ -76,6 +76,7 @@ KMEM_CACHE_CREATE_DTOR = @KMEM_CACHE_CREATE_DTOR@
 OLD_BIO_END_IO_T = @OLD_BIO_END_IO_T@
 NO_FAULT_IN_VMOPS = @NO_FAULT_IN_VMOPS@
 GET_RETURNS_U64_IN_SIMPLE_ATTR_OPEN = @GET_RETURNS_U64_IN_SIMPLE_ATTR_OPEN@
+NO_SHOULD_REMOVE_SUID = @NO_SHOULD_REMOVE_SUID@
 
 
 OCFS_DEBUG = @OCFS_DEBUG@
Makefile +2 -1
index 898879d..8536d51 100644
@@ -32,7 +32,8 @@ KAPI_COMPAT_FILES = \
 	kapi-compat/include/sock_shutdown.h		\
 	kapi-compat/include/bdi_init.h			\
 	kapi-compat/include/bdi_define.h		\
-	kapi-compat/include/inode_permission.h
+	kapi-compat/include/inode_permission.h		\
+	kapi-compat/include/should_remove_suid.h
 
 PATCH_FILES =
 
configure.in +10 -0
index b8f1bd8..3b8fd4e 100644
@@ -389,6 +389,16 @@ OCFS2_CHECK_KERNEL([	get() return u64 in simple_attr_open() in fs.h], fs.h,
  GET_RETURNS_U64_IN_SIMPLE_ATTR_OPEN=yes, , [u64 (\*get)(void \*), void (\*set)(void \*, u64),])
 AC_SUBST(GET_RETURNS_U64_IN_SIMPLE_ATTR_OPEN)
 
+NO_SHOULD_REMOVE_SUID=
+AC_MSG_CHECKING(for	including should_remove_suid())
+AC_ARG_ENABLE(srsuid, [  --enable-srsuid=[yes/no]	Include should_remove_suid() [default=yes]],,enable_srsuid=yes)
+if test "x$enable_srsuid" = "xyes"; then
+  NO_SHOULD_REMOVE_SUID=yes
+  KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS should_remove_suid.h"
+fi
+AC_SUBST(NO_SHOULD_REMOVE_SUID)
+AC_MSG_RESULT($enable_srsuid)
+
 # End kapi_compat checks
 
 # using -include has two advantages:
fs/ocfs2/Makefile +6 -0
index 6960f40..4a4c250 100644
@@ -104,6 +104,12 @@ ifdef GET_RETURNS_U64_IN_SIMPLE_ATTR_OPEN
 EXTRA_CFLAGS += -DGET_RETURNS_U64_IN_SIMPLE_ATTR_OPEN
 endif
 
+COMPAT_SOURCES += compat_should_remove_suid.c
+ifdef NO_SHOULD_REMOVE_SUID
+FS_SOURCES += compat_should_remove_suid.c
+EXTRA_CFLAGS += -DNO_SHOULD_REMOVE_SUID
+endif
+
 #
 # Since SUBDIRS means something to kbuild, define them safely.  Do not
 # include trailing slashes.
fs/ocfs2/compat_should_remove_suid.c new file +40 -0
new file mode 100644
index 0000000..6b4fdc7
@@ -0,0 +1,40 @@
+/*
+ * compat_should_remove_suid.c
+ *
+ * This code has been copied from mainline linux kernel git commit
+ * e7b34019606ab1dd06196635e931b0c302799228 to allow ocfs2 to build
+ * against older kernels. For license, refer to mm/filemap.c in mainline
+ * linux kernel.
+ *
+ */
+
+#include <linux/fs.h>
+#include <linux/capability.h>
+
+/*
+ * The logic we want is
+ *
+ *	if suid or (sgid and xgrp)
+ *		remove privs
+ */
+int should_remove_suid(struct dentry *dentry)
+{
+	mode_t mode = dentry->d_inode->i_mode;
+	int kill = 0;
+
+	/* suid always must be killed */
+	if (unlikely(mode & S_ISUID))
+		kill = ATTR_KILL_SUID;
+
+	/*
+	 * sgid without any exec bits is just a mandatory locking mark; leave
+	 * it alone.  If some exec bits are set, it's a real sgid; kill it.
+	 */
+	if (unlikely((mode & S_ISGID) && (mode & S_IXGRP)))
+		kill |= ATTR_KILL_SGID;
+
+	if (unlikely(kill && !capable(CAP_FSETID)))
+		return kill;
+
+	return 0;
+}
kapi-compat/include/should_remove_suid.h new file +12 -0
new file mode 100644
index 0000000..8491125
@@ -0,0 +1,12 @@
+#ifndef KAPI_SHOULD_REMOVE_SUID_H
+#define KAPI_SHOULD_REMOVE_SUID_H
+
+#ifdef NO_SHOULD_REMOVE_SUID
+
+#include <linux/fs.h>
+
+int should_remove_suid(struct dentry *dentry);
+
+#endif
+
+#endif
Signature · 1 line
1.5.6.5
#18 lore raw

PATCH 16/18 ocfs2: Handle missing struct path in struct nameidata

In reply to Sunil Mushran

Mainline commit 4ac9137858e08a19f29feac4e1f4df7c268b0ba5 embedded struct path into struct nameidata. Mainline commit 2d8f30380ab8c706f4e0a8f1aaa22b5886e9ac8a added new helpers like user_path_at() that passed struct path instead of struct nameidata.

Patch adds access wrappers to allow building against current and EL5 kernels.

---
 Makefile                           |    3 ++-
 configure.in                       |    5 +++++
 fs/ocfs2/kapi-default.h            |    9 +++++++++
 fs/ocfs2/refcounttree.c            |   18 +++++++++---------
 kapi-compat/include/user_path_at.h |   11 +++++++++++
 5 files changed, 36 insertions(+), 10 deletions(-)
 create mode 100644 kapi-compat/include/user_path_at.h
Makefile +2 -1
index 8536d51..3447409 100644
@@ -33,7 +33,8 @@ KAPI_COMPAT_FILES = \
 	kapi-compat/include/bdi_init.h			\
 	kapi-compat/include/bdi_define.h		\
 	kapi-compat/include/inode_permission.h		\
-	kapi-compat/include/should_remove_suid.h
+	kapi-compat/include/should_remove_suid.h	\
+	kapi-compat/include/user_path_at.h
 
 PATCH_FILES =
 
configure.in +5 -0
index 3b8fd4e..86dc11b 100644
@@ -399,6 +399,11 @@ fi
 AC_SUBST(NO_SHOULD_REMOVE_SUID)
 AC_MSG_RESULT($enable_srsuid)
 
+user_path_header=
+OCFS2_CHECK_KERNEL([struct path in struct nameidata in namei.h], namei.h,
+ , user_path_header=user_path_at.h, [struct path.*path;])
+KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS $user_path_header"
+
 # End kapi_compat checks
 
 # using -include has two advantages:
fs/ocfs2/kapi-default.h +9 -0
index 2f60b87..7b16678 100644
@@ -54,4 +54,13 @@ typedef u64 f_version_t;
 # define kapi_kmem_cache_create(a, b, c, d, e)	kmem_cache_create(a, b, c, d, e)
 #endif
 
+#ifndef kapi_path
+# define kapi_path			path
+# define kapi_path_put			path_put
+# define kapi_user_path_at(a, b, c, d)	user_path_at(a, b, c, d)
+# define kapi_to_mnt(a)			(a).path.mnt
+# define kapi_to_dentry(a)		(a).path.dentry
+# define kapi_to_path_ptr(a)		(&(a).path)
+#endif
+
 #endif
fs/ocfs2/refcounttree.c +9 -9
index 60287fc..49771c3 100644
@@ -4260,14 +4260,14 @@ int ocfs2_reflink_ioctl(struct inode *inode,
 {
 	struct dentry *new_dentry;
 	struct nameidata nd;
-	struct path old_path;
+	struct kapi_path old_path;
 	int error;
 	char *to = NULL;
 
 	if (!ocfs2_refcount_tree(OCFS2_SB(inode->i_sb)))
 		return -EOPNOTSUPP;
 
-	error = user_path_at(AT_FDCWD, oldname, 0, &old_path);
+	error = kapi_user_path_at(AT_FDCWD, oldname, 0, &old_path);
 	if (error) {
 		mlog_errno(error);
 		return error;
@@ -4280,7 +4280,7 @@ int ocfs2_reflink_ioctl(struct inode *inode,
 	}
 
 	error = -EXDEV;
-	if (old_path.mnt != nd.path.mnt)
+	if (old_path.mnt != kapi_to_mnt(nd))
 		goto out_release;
 	new_dentry = lookup_create(&nd, 0);
 	error = PTR_ERR(new_dentry);
@@ -4289,25 +4289,25 @@ int ocfs2_reflink_ioctl(struct inode *inode,
 		goto out_unlock;
 	}
 
-	error = mnt_want_write(nd.path.mnt);
+	error = mnt_want_write(kapi_to_mnt(nd));
 	if (error) {
 		mlog_errno(error);
 		goto out_dput;
 	}
 
 	error = ocfs2_vfs_reflink(old_path.dentry,
-				  nd.path.dentry->d_inode,
+				  kapi_to_dentry(nd)->d_inode,
 				  new_dentry, preserve);
-	mnt_drop_write(nd.path.mnt);
+	mnt_drop_write(kapi_to_mnt(nd));
 out_dput:
 	dput(new_dentry);
 out_unlock:
-	mutex_unlock(&nd.path.dentry->d_inode->i_mutex);
+	mutex_unlock(&kapi_to_dentry(nd)->d_inode->i_mutex);
 out_release:
-	path_put(&nd.path);
+	kapi_path_put(kapi_to_path_ptr(nd));
 	putname(to);
 out:
-	path_put(&old_path);
+	kapi_path_put(&old_path);
 
 	return error;
 }
kapi-compat/include/user_path_at.h new file +11 -0
new file mode 100644
index 0000000..fc11d36
@@ -0,0 +1,11 @@
+#ifndef KAPI_USER_WALK_AT_H
+#define KAPI_USER_WALK_AT_H
+
+#define	kapi_path			nameidata
+#define kapi_path_put			path_release
+#define kapi_user_path_at(a, b, c, d)	__user_walk(b, c, d)
+#define kapi_to_mnt(a)			(a).mnt
+#define kapi_to_dentry(a)		(a).dentry
+#define kapi_to_path_ptr(a)		(&(a))
+
+#endif
Signature · 1 line
1.5.6.5
#19 lore raw

PATCH 17/18 ocfs2: Handle missing filemap_fdatawait_range()

In reply to Sunil Mushran

Mainline commit 918941a3f3d46c2a69971b4718aaf13b1be2f1a7 replaced generic_file_aio_write_nolock() with __generic_file_aio_write()
and made use of helpers filemap_fdatawrite_range() and filemap_fdatawait_range().

Patch adds macros to allow building with current and older EL5 kernels.

---
 Makefile                                      |    3 ++-
 configure.in                                  |    5 +++++
 fs/ocfs2/file.c                               |    6 +++---
 fs/ocfs2/kapi-default.h                       |    6 ++++++
 kapi-compat/include/filemap_fdatawait_range.h |    8 ++++++++
 5 files changed, 24 insertions(+), 4 deletions(-)
 create mode 100644 kapi-compat/include/filemap_fdatawait_range.h
Makefile +2 -1
index 3447409..7d9e0a9 100644
@@ -34,7 +34,8 @@ KAPI_COMPAT_FILES = \
 	kapi-compat/include/bdi_define.h		\
 	kapi-compat/include/inode_permission.h		\
 	kapi-compat/include/should_remove_suid.h	\
-	kapi-compat/include/user_path_at.h
+	kapi-compat/include/user_path_at.h		\
+	kapi-compat/include/filemap_fdatawait_range.h
 
 PATCH_FILES =
 
configure.in +5 -0
index 86dc11b..a992f4b 100644
@@ -404,6 +404,11 @@ OCFS2_CHECK_KERNEL([struct path in struct nameidata in namei.h], namei.h,
  , user_path_header=user_path_at.h, [struct path.*path;])
 KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS $user_path_header"
 
+fdatawait_header=
+OCFS2_CHECK_KERNEL([filemap_fdatawait_range() in fs.h], fs.h,
+ , fdatawait_header=filemap_fdatawait_range.h, [extern int filemap_fdatawait_range(struct address_space \*,])
+KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS $fdatawait_header"
+
 # End kapi_compat checks
 
 # using -include has two advantages:
fs/ocfs2/file.c +3 -3
index 4c12c2d..1367586 100644
@@ -2002,7 +2002,7 @@ relock:
 			goto out_dio;
 		}
 	} else {
-		written = __generic_file_aio_write(iocb, iov, nr_segs, ppos);
+		written = kapi_generic_file_aio_write(iocb, iov, nr_segs, ppos);
 	}
 
 out_dio:
@@ -2010,7 +2010,7 @@ out_dio:
 	BUG_ON(ret == -EIOCBQUEUED && !(file->f_flags & O_DIRECT));
 
 	if ((file->f_flags & O_SYNC && !direct_io) || IS_SYNC(inode)) {
-		ret = filemap_fdatawrite_range(file->f_mapping, pos,
+		ret = kapi_filemap_fdatawrite_range(file->f_mapping, pos,
 					       pos + count - 1);
 		if (ret < 0)
 			written = ret;
@@ -2023,7 +2023,7 @@ out_dio:
 		}
 
 		if (!ret)
-			ret = filemap_fdatawait_range(file->f_mapping, pos,
+			ret = kapi_filemap_fdatawait_range(file->f_mapping, pos,
 						      pos + count - 1);
 	}
 
fs/ocfs2/kapi-default.h +6 -0
index 7b16678..b1afdcf 100644
@@ -63,4 +63,10 @@ typedef u64 f_version_t;
 # define kapi_to_path_ptr(a)		(&(a).path)
 #endif
 
+#ifndef kapi_generic_file_aio_write
+# define kapi_generic_file_aio_write		__generic_file_aio_write
+# define kapi_filemap_fdatawrite_range		filemap_fdatawrite_range
+# define kapi_filemap_fdatawait_range		filemap_fdatawait_range
+#endif
+
 #endif
kapi-compat/include/filemap_fdatawait_range.h new file +8 -0
new file mode 100644
index 0000000..47840af
@@ -0,0 +1,8 @@
+#ifndef FILEMAP_FDATAWAIT_RANGE_H
+#define FILEMAP_FDATAWAIT_RANGE_H
+
+#define kapi_generic_file_aio_write		generic_file_aio_write_nolock
+#define kapi_filemap_fdatawrite_range(a, b, c)	0
+#define kapi_filemap_fdatawait_range(a, b, c)	0
+
+#endif
Signature · 1 line
1.5.6.5
#20 lore raw

PATCH 17/18 ocfs2: Handle missing filemap_fdatawait_range()

Quoted 5 lines · Sunil Mushran

Mainline commit 918941a3f3d46c2a69971b4718aaf13b1be2f1a7 replaced generic_file_aio_write_nolock() with __generic_file_aio_write()
and made use of helpers filemap_fdatawrite_range() and filemap_fdatawait_range().

Patch adds macros to allow building with current and older EL5 kernels.

Ok, if I remember correctly, the old
generic_file_aio_write_nlock() would do the sync work for us. Please add a comment in filemap_fdatawait_range.h about this so people don't worry that the define becomes 0.

Joel

Signature · 7 lines
"Drake!  We're LEAVING!"

Joel Becker
Principal Software Developer
Oracle
E-mail: joel.becker at oracle.com
Phone: (650) 506-8127
#21 lore raw

PATCH 18/18 ocfs2: Add fops->sendfile()

In reply to Sunil Mushran

fops->sendfile() was removed in 2.6.23. Patch re-adds it and uses it if built with EL5.

---
 Config.make.in    |    1 +
 configure.in      |    5 +++++
 fs/ocfs2/Makefile |    4 ++++
 fs/ocfs2/file.c   |   45 +++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 55 insertions(+), 0 deletions(-)
Config.make.in +1 -0
index 4b5f4c3..02b8c9c 100644
@@ -77,6 +77,7 @@ OLD_BIO_END_IO_T = @OLD_BIO_END_IO_T@
 NO_FAULT_IN_VMOPS = @NO_FAULT_IN_VMOPS@
 GET_RETURNS_U64_IN_SIMPLE_ATTR_OPEN = @GET_RETURNS_U64_IN_SIMPLE_ATTR_OPEN@
 NO_SHOULD_REMOVE_SUID = @NO_SHOULD_REMOVE_SUID@
+HAS_FOPS_SENDFILE = @HAS_FOPS_SENDFILE@
 
 
 OCFS_DEBUG = @OCFS_DEBUG@
configure.in +5 -0
index a992f4b..5bc9d42 100644
@@ -409,6 +409,11 @@ OCFS2_CHECK_KERNEL([filemap_fdatawait_range() in fs.h], fs.h,
  , fdatawait_header=filemap_fdatawait_range.h, [extern int filemap_fdatawait_range(struct address_space \*,])
 KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS $fdatawait_header"
 
+HAS_FOPS_SENDFILE=
+OCFS2_CHECK_KERNEL([	fops->sendfile() in fs.h], fs.h,
+  HAS_FOPS_SENDFILE=yes, , [^.*ssize_t (\*sendfile)])
+AC_SUBST(HAS_FOPS_SENDFILE)
+
 # End kapi_compat checks
 
 # using -include has two advantages:
fs/ocfs2/Makefile +4 -0
index 4a4c250..2e85623 100644
@@ -110,6 +110,10 @@ FS_SOURCES += compat_should_remove_suid.c
 EXTRA_CFLAGS += -DNO_SHOULD_REMOVE_SUID
 endif
 
+ifdef HAS_FOPS_SENDFILE
+EXTRA_CFLAGS += -DHAS_FOPS_SENDFILE
+endif
+
 #
 # Since SUBDIRS means something to kbuild, define them safely.  Do not
 # include trailing slashes.
fs/ocfs2/file.c +45 -0

63 lines not on this page · raw message

Signature · 1 line
1.5.6.5