diff --git a/0001-LU-16327-llite-read_folio-release_folio-filler_t.patch b/0001-LU-16327-llite-read_folio-release_folio-filler_t.patch deleted file mode 100644 index 4cbdd98fbd0da6fee2885fadadcc1cfad73aaca9..0000000000000000000000000000000000000000 --- a/0001-LU-16327-llite-read_folio-release_folio-filler_t.patch +++ /dev/null @@ -1,479 +0,0 @@ -From b489be535aa07e15dbfa498d0fc920b893709846 Mon Sep 17 00:00:00 2001 -From: Shaun Tancheff -Date: Tue, 21 Mar 2023 00:37:00 -0500 -Subject: [PATCH 1/5] LU-16327 llite: read_folio, release_folio, filler_t - -Linux commit v5.18-rc5-221-gb7446e7cf15f - fs: Remove aop flags parameter from grab_cache_page_write_begin() -flags have been dropped from write_begin() and -grab_cache_page_write_begin() - -Linux commit v5.18-rc5-241-g5efe7448a142 - fs: Introduce aops->read_folio -Provide a ll_read_folio handler around ll_readpage - -Linux commit v5.18-rc5-280-ge9b5b23e957e - fs: Change the type of filler_t -Affects read_cache_page, provides a wrapper for read_cache_page -and wrappers for filler functions - -Linux commit v5.18-rc5-282-gfa29000b6b26 - fs: Add aops->release_folio -Provide an ll_release_folio function based on ll_releasepage - -Test-Parameters: trivial -HPE-bug-id: LUS-11357 -Signed-off-by: Shaun Tancheff -Change-Id: Ibd4ec1133c80cd0eb8400c4cd07b50e421dd35c5 ---- - lustre/autoconf/lustre-core.m4 | 130 +++++++++++++++++++++++++++++++-- - lustre/include/lustre_compat.h | 18 +++++ - lustre/llite/file.c | 14 +++- - lustre/llite/llite_internal.h | 3 + - lustre/llite/rw.c | 9 ++- - lustre/llite/rw26.c | 83 ++++++++++++++++++++- - lustre/mdc/mdc_request.c | 21 ++++-- - 7 files changed, 259 insertions(+), 19 deletions(-) - -diff --git a/lustre/autoconf/lustre-core.m4 b/lustre/autoconf/lustre-core.m4 -index 0f7307242e..984ea8bcc7 100644 ---- a/lustre/autoconf/lustre-core.m4 -+++ b/lustre/autoconf/lustre-core.m4 -@@ -3126,27 +3126,126 @@ AC_DEFUN([LC_HAVE_DIRTY_FOLIO], [ - # linux commit v5.17-49-g8b9f3ac5b01d - # fs: introduce alloc_inode_sb() to allocate filesystems specific inode - # --AC_DEFUN([LC_HAVE_ALLOC_INODE_SB], [ --tmp_flags="$EXTRA_KCFLAGS" --EXTRA_KCFLAGS="-Werror" --LB_CHECK_COMPILE([if alloc_inode_sb() exists], --alloc_inode_sb, [ -+AC_DEFUN([LC_SRC_HAVE_ALLOC_INODE_SB], [ -+ LB2_LINUX_TEST_SRC([alloc_inode_sb], [ - #include - ],[ - struct super_block *sb = NULL; - struct kmem_cache *cache = NULL; - - (void)alloc_inode_sb(sb, cache, GFP_NOFS); -- ],[ -+ ],[-Werror]) -+]) -+AC_DEFUN([LC_HAVE_ALLOC_INODE_SB], [ -+ AC_MSG_CHECKING([if alloc_inode_sb() exists]) -+ LB2_LINUX_TEST_RESULT([alloc_inode_sb], [ - AC_DEFINE(HAVE_ALLOC_INODE_SB, 1, - [alloc_inode_sb() exists]) - ]) --EXTRA_KCFLAGS="$tmp_flags" - ]) # LC_HAVE_ALLOC_INODE_SB - - AC_DEFUN([LC_PROG_LINUX_SRC], []) - AC_DEFUN([LC_PROG_LINUX_RESULTS], []) - -+# -+# LC_GRAB_CACHE_PAGE_WRITE_BEGIN_WITH_FLAGS -+# -+# Linux commit v5.18-rc5-221-gb7446e7cf15f -+# fs: Remove aop flags parameter from grab_cache_page_write_begin() -+# -+AC_DEFUN([LC_SRC_GRAB_CACHE_PAGE_WRITE_BEGIN_WITH_FLAGS], [ -+ LB2_LINUX_TEST_SRC([grab_cache_page_write_begin_with_flags], [ -+ #include -+ ],[ -+ struct address_space *mapping = NULL; -+ (void)grab_cache_page_write_begin(mapping, 0, 1); -+ ],[-Werror]) -+]) -+AC_DEFUN([LC_GRAB_CACHE_PAGE_WRITE_BEGIN_WITH_FLAGS], [ -+ AC_MSG_CHECKING([if grab_cache_page_write_begin() has flags argument]) -+ LB2_LINUX_TEST_RESULT([grab_cache_page_write_begin_with_flags], [ -+ AC_DEFINE(HAVE_GRAB_CACHE_PAGE_WRITE_BEGIN_WITH_FLAGS, 1, -+ [grab_cache_page_write_begin() has flags argument]) -+ ]) -+]) # LC_GRAB_CACHE_PAGE_WRITE_BEGIN_WITH_FLAGS -+ -+# -+# LC_HAVE_ADDRESS_SPACE_OPERATIONS_READ_FOLIO -+# -+# Linux commit v5.18-rc5-241-g5efe7448a142 -+# fs: Introduce aops->read_folio -+# -+AC_DEFUN([LC_SRC_HAVE_ADDRESS_SPACE_OPERATIONS_READ_FOLIO], [ -+ LB2_LINUX_TEST_SRC([address_space_operations_read_folio], [ -+ #include -+ ],[ -+ struct address_space_operations *aops = NULL; -+ struct file *file = NULL; -+ struct folio *folio = NULL; -+ int err = aops->read_folio(file, folio); -+ (void)err; -+ ],[-Werror]) -+]) -+AC_DEFUN([LC_HAVE_ADDRESS_SPACE_OPERATIONS_READ_FOLIO], [ -+ AC_MSG_CHECKING([if struct address_space_operations() has read_folio()]) -+ LB2_LINUX_TEST_RESULT([address_space_operations_read_folio], [ -+ AC_DEFINE(HAVE_AOPS_READ_FOLIO, 1, -+ [struct address_space_operations() has read_folio()]) -+ ]) -+]) # LC_HAVE_ADDRESS_SPACE_OPERATIONS_READ_FOLIO -+ -+# -+# LC_HAVE_READ_CACHE_PAGE_FILLER_WITH_FILE -+# -+# Linux commit v5.18-rc5-280-ge9b5b23e957e -+# fs: Change the type of filler_t -+# -+AC_DEFUN([LC_SRC_HAVE_READ_CACHE_PAGE_FILLER_WITH_FILE], [ -+ LB2_LINUX_TEST_SRC([read_cache_page_filler_with_file], [ -+ #include -+ static inline int _filler(struct file *file, struct folio *f) -+ { -+ return 0; -+ } -+ ],[ -+ struct address_space *mapping = NULL; -+ struct file *file = NULL; -+ struct page *page = read_cache_page(mapping, 0, _filler, file); -+ (void)page; -+ ],[-Werror]) -+]) -+AC_DEFUN([LC_HAVE_READ_CACHE_PAGE_FILLER_WITH_FILE], [ -+ AC_MSG_CHECKING([if read_cache_page() filler_t needs struct file]) -+ LB2_LINUX_TEST_RESULT([read_cache_page_filler_with_file], [ -+ AC_DEFINE(HAVE_READ_CACHE_PAGE_WANTS_FILE, 1, -+ [read_cache_page() filler_t needs struct file]) -+ ]) -+]) # LC_HAVE_READ_CACHE_PAGE_FILLER_WITH_FILE -+ -+# -+# LC_HAVE_ADDRESS_SPACE_OPERATIONS_RELEASE_FOLIO -+# -+# Linux commit v5.18-rc5-282-gfa29000b6b26 -+# fs: Add aops->release_folio -+# -+AC_DEFUN([LC_SRC_HAVE_ADDRESS_SPACE_OPERATIONS_RELEASE_FOLIO], [ -+ LB2_LINUX_TEST_SRC([address_space_operations_release_folio], [ -+ #include -+ ],[ -+ struct address_space_operations *aops = NULL; -+ struct folio *folio = NULL; -+ int err = aops->release_folio(folio, GFP_KERNEL); -+ (void)err; -+ ],[-Werror]) -+]) -+AC_DEFUN([LC_HAVE_ADDRESS_SPACE_OPERATIONS_RELEASE_FOLIO], [ -+ AC_MSG_CHECKING([if struct address_space_operations() has release_folio()]) -+ LB2_LINUX_TEST_RESULT([address_space_operations_release_folio], [ -+ AC_DEFINE(HAVE_AOPS_RELEASE_FOLIO, 1, -+ [struct address_space_operations() has release_folio()]) -+ ]) -+]) # LC_HAVE_ADDRESS_SPACE_OPERATIONS_RELEASE_FOLIO -+ - # - # LC_PROG_LINUX - # -@@ -3354,10 +3453,19 @@ AC_DEFUN([LC_PROG_LINUX_SRC], [ - LC_SRC_HAVE_SECURITY_DENTRY_INIT_WITH_XATTR_NAME_ARG - LC_SRC_HAVE_KIOCB_COMPLETE_2ARGS - -- # 5.18 -+ # 5.17 - LC_SRC_HAVE_INVALIDATE_FOLIO - LC_SRC_HAVE_DIRTY_FOLIO - -+ # 5.18 -+ LC_SRC_HAVE_ALLOC_INODE_SB -+ -+ # 5.19 -+ LC_SRC_GRAB_CACHE_PAGE_WRITE_BEGIN_WITH_FLAGS -+ LC_SRC_HAVE_ADDRESS_SPACE_OPERATIONS_READ_FOLIO -+ LC_SRC_HAVE_READ_CACHE_PAGE_FILLER_WITH_FILE -+ LC_SRC_HAVE_ADDRESS_SPACE_OPERATIONS_RELEASE_FOLIO -+ - # kernel patch to extend integrity interface - LC_SRC_BIO_INTEGRITY_PREP_FN - ]) -@@ -3582,6 +3690,12 @@ AC_DEFUN([LC_PROG_LINUX_RESULTS], [ - # 5.18 - LC_HAVE_ALLOC_INODE_SB - -+ # 5.19 -+ LC_GRAB_CACHE_PAGE_WRITE_BEGIN_WITH_FLAGS -+ LC_HAVE_ADDRESS_SPACE_OPERATIONS_READ_FOLIO -+ LC_HAVE_READ_CACHE_PAGE_FILLER_WITH_FILE -+ LC_HAVE_ADDRESS_SPACE_OPERATIONS_RELEASE_FOLIO -+ - # kernel patch to extend integrity interface - LC_BIO_INTEGRITY_PREP_FN - ]) -diff --git a/lustre/include/lustre_compat.h b/lustre/include/lustre_compat.h -index 4f2bd8af4e..cfb6e03856 100644 ---- a/lustre/include/lustre_compat.h -+++ b/lustre/include/lustre_compat.h -@@ -620,4 +620,22 @@ static inline void cfs_delete_from_page_cache(struct page *page) - } - #endif - -+static inline struct page *ll_read_cache_page(struct address_space *mapping, -+ pgoff_t index, filler_t *filler, -+ void *data) -+{ -+#ifdef HAVE_READ_CACHE_PAGE_WANTS_FILE -+ struct page *page = NULL; -+ struct file dummy_file; -+ -+ dummy_file.f_ra.ra_pages = 32; /* unused, modified on ra error */ -+ dummy_file.private_data = data; -+ page = read_cache_page(mapping, index, filler, &dummy_file); -+ -+ return page; -+#else -+ return read_cache_page(mapping, index, filler, data); -+#endif /* HAVE_READ_CACHE_PAGE_WANTS_FILE */ -+} -+ - #endif /* _LUSTRE_COMPAT_H */ -diff --git a/lustre/llite/file.c b/lustre/llite/file.c -index 692e3e5ff9..f08e084250 100644 ---- a/lustre/llite/file.c -+++ b/lustre/llite/file.c -@@ -491,6 +491,16 @@ static inline int ll_dom_readpage(void *data, struct page *page) - return rc; - } - -+#ifdef HAVE_READ_CACHE_PAGE_WANTS_FILE -+static inline int ll_dom_read_folio(struct file *file, struct folio *folio0) -+{ -+ return ll_dom_readpage(file->private_data, folio_page(folio0, 0)); -+} -+#define USE_FILLER_DOM ll_dom_read_folio -+#else -+#define USE_FILLER_DOM ll_dom_readpage -+#endif -+ - void ll_dom_finish_open(struct inode *inode, struct ptlrpc_request *req) - { - struct lu_env *env; -@@ -568,8 +578,8 @@ void ll_dom_finish_open(struct inode *inode, struct ptlrpc_request *req) - if (lnb.lnb_len > PAGE_SIZE) - lnb.lnb_len = PAGE_SIZE; - -- vmpage = read_cache_page(mapping, index + start, -- ll_dom_readpage, &lnb); -+ vmpage = ll_read_cache_page(mapping, index + start, -+ USE_FILLER_DOM, &lnb); - if (IS_ERR(vmpage)) { - CWARN("%s: cannot fill page %lu for "DFID - " with data: rc = %li\n", -diff --git a/lustre/llite/llite_internal.h b/lustre/llite/llite_internal.h -index 60ac65086b..4aa39e49ba 100644 ---- a/lustre/llite/llite_internal.h -+++ b/lustre/llite/llite_internal.h -@@ -1152,6 +1152,9 @@ void ll_update_times(struct ptlrpc_request *request, struct inode *inode); - int ll_writepage(struct page *page, struct writeback_control *wbc); - int ll_writepages(struct address_space *, struct writeback_control *wbc); - int ll_readpage(struct file *file, struct page *page); -+#ifdef HAVE_AOPS_READ_FOLIO -+int ll_read_folio(struct file *file, struct folio *folio); -+#endif - int ll_io_read_page(const struct lu_env *env, struct cl_io *io, - struct cl_page *page, struct file *file); - void ll_readahead_init(struct inode *inode, struct ll_readahead_state *ras); -diff --git a/lustre/llite/rw.c b/lustre/llite/rw.c -index 49f1688a5f..d4b6a49157 100644 ---- a/lustre/llite/rw.c -+++ b/lustre/llite/rw.c -@@ -2041,7 +2041,7 @@ int ll_readpage(struct file *file, struct page *vmpage) - } else { - unlock_page(vmpage); - result = PTR_ERR(page); -- } -+ } - - out: - if (ra.cra_release != NULL) -@@ -2049,3 +2049,10 @@ out: - - RETURN(result); - } -+ -+#ifdef HAVE_AOPS_READ_FOLIO -+int ll_read_folio(struct file *file, struct folio *folio) -+{ -+ return ll_readpage(file, folio_page(folio, 0)); -+} -+#endif -diff --git a/lustre/llite/rw26.c b/lustre/llite/rw26.c -index c07c321fbe..f4c79def2c 100644 ---- a/lustre/llite/rw26.c -+++ b/lustre/llite/rw26.c -@@ -166,6 +166,68 @@ static void ll_invalidatepage(struct page *vmpage, - } - #endif - -+#ifdef HAVE_AOPS_RELEASE_FOLIO -+static bool ll_release_folio(struct folio *folio, gfp_t wait) -+{ -+ struct lu_env *env; -+ struct cl_object *obj; -+ struct cl_page *clpage; -+ struct address_space *mapping; -+ struct page *vmpage; -+ int result = 0; -+ -+ LASSERT(folio_test_locked(folio)); -+ if (folio_test_writeback(folio) || folio_test_dirty(folio)) -+ return 0; -+ -+ mapping = folio->mapping; -+ if (mapping == NULL) -+ return 1; -+ -+ obj = ll_i2info(mapping->host)->lli_clob; -+ if (obj == NULL) -+ return 1; -+ -+ vmpage = folio_page(folio, 0); -+ clpage = cl_vmpage_page(vmpage, obj); -+ if (clpage == NULL) -+ return 1; -+ -+ env = cl_env_percpu_get(); -+ LASSERT(!IS_ERR(env)); -+ -+ /* we must not delete the cl_page if the vmpage is in use, otherwise we -+ * disconnect the vmpage from Lustre while it's still alive(!), which -+ * means we won't find it to discard on lock cancellation. -+ * -+ * References here are: caller + cl_page + page cache. -+ * Any other references are potentially transient and must be ignored. -+ */ -+ if (!cl_page_in_use(clpage) && !vmpage_in_use(vmpage, 1)) { -+ result = 1; -+ cl_page_delete(env, clpage); -+ } -+ -+ /* To use percpu env array, the call path can not be rescheduled; -+ * otherwise percpu array will be messed if ll_releaspage() called -+ * again on the same CPU. -+ * -+ * If this page holds the last refc of cl_object, the following -+ * call path may cause reschedule: -+ * cl_page_put -> cl_page_free -> cl_object_put -> -+ * lu_object_put -> lu_object_free -> lov_delete_raid0. -+ * -+ * However, the kernel can't get rid of this inode until all pages have -+ * been cleaned up. Now that we hold page lock here, it's pretty safe -+ * that we won't get into object delete path. -+ */ -+ LASSERT(cl_object_refc(obj) > 1); -+ cl_page_put(env, clpage); -+ -+ cl_env_percpu_put(env); -+ return result; -+} -+#else /* !HAVE_AOPS_RELEASE_FOLIO */ - #ifdef HAVE_RELEASEPAGE_WITH_INT - #define RELEASEPAGE_ARG_TYPE int - #else -@@ -229,6 +291,7 @@ static int ll_releasepage(struct page *vmpage, RELEASEPAGE_ARG_TYPE gfp_mask) - cl_env_percpu_put(env); - return result; - } -+#endif /* HAVE_AOPS_RELEASE_FOLIO */ - - static ssize_t ll_get_user_pages(int rw, struct iov_iter *iter, - struct page ***pages, ssize_t *npages, -@@ -707,7 +770,10 @@ static int ll_tiny_write_begin(struct page *vmpage, struct address_space *mappin - } - - static int ll_write_begin(struct file *file, struct address_space *mapping, -- loff_t pos, unsigned len, unsigned flags, -+ loff_t pos, unsigned int len, -+#ifdef HAVE_GRAB_CACHE_PAGE_WRITE_BEGIN_WITH_FLAGS -+ unsigned int flags, -+#endif - struct page **pagep, void **fsdata) - { - struct ll_cl_context *lcc = NULL; -@@ -780,8 +846,11 @@ again: - GOTO(out, result); - - if (vmpage == NULL) { -- vmpage = grab_cache_page_write_begin(mapping, index, -- flags); -+ vmpage = grab_cache_page_write_begin(mapping, index -+#ifdef HAVE_GRAB_CACHE_PAGE_WRITE_BEGIN_WITH_FLAGS -+ , flags -+#endif -+ ); - if (vmpage == NULL) - GOTO(out, result = -ENOMEM); - } -@@ -987,8 +1056,16 @@ const struct address_space_operations ll_aops = { - #else - .invalidatepage = ll_invalidatepage, - #endif -+#ifdef HAVE_AOPS_READ_FOLIO -+ .read_folio = ll_read_folio, -+#else - .readpage = ll_readpage, -+#endif -+#ifdef HAVE_AOPS_RELEASE_FOLIO -+ .release_folio = ll_release_folio, -+#else - .releasepage = (void *)ll_releasepage, -+#endif - .direct_IO = ll_direct_IO, - .writepage = ll_writepage, - .writepages = ll_writepages, -diff --git a/lustre/mdc/mdc_request.c b/lustre/mdc/mdc_request.c -index 0fcdb4982d..1140fab704 100644 ---- a/lustre/mdc/mdc_request.c -+++ b/lustre/mdc/mdc_request.c -@@ -1330,7 +1330,7 @@ struct readpage_param { - * in PAGE_SIZE (if PAGE_SIZE greater than LU_PAGE_SIZE), and the - * lu_dirpage for this integrated page will be adjusted. - **/ --static int mdc_read_page_remote(void *data, struct page *page0) -+static int ll_mdc_read_page_remote(void *data, struct page *page0) - { - struct readpage_param *rp = data; - struct page **page_pool; -@@ -1426,6 +1426,17 @@ static int mdc_read_page_remote(void *data, struct page *page0) - RETURN(rc); - } - -+#ifdef HAVE_READ_CACHE_PAGE_WANTS_FILE -+static inline int mdc_read_folio_remote(struct file *file, struct folio *folio) -+{ -+ return ll_mdc_read_page_remote(file->private_data, -+ folio_page(folio, 0)); -+} -+#define USE_FILLER_MDC mdc_read_folio_remote -+#else -+#define USE_FILLER_MDC ll_mdc_read_page_remote -+#endif -+ - /** - * Read dir page from cache first, if it can not find it, read it from - * server and add into the cache. -@@ -1508,10 +1519,10 @@ static int mdc_read_page(struct obd_export *exp, struct md_op_data *op_data, - - rp_param.rp_exp = exp; - rp_param.rp_mod = op_data; -- page = read_cache_page(mapping, -- hash_x_index(rp_param.rp_off, -- rp_param.rp_hash64), -- mdc_read_page_remote, &rp_param); -+ page = ll_read_cache_page(mapping, -+ hash_x_index(rp_param.rp_off, -+ rp_param.rp_hash64), -+ USE_FILLER_MDC, &rp_param); - if (IS_ERR(page)) { - CDEBUG(D_INFO, "%s: read cache page: "DFID" at %llu: %ld\n", - exp->exp_obd->obd_name, PFID(&op_data->op_fid1), --- -2.39.1 - diff --git a/0002-LU-16328-llite-Linux-6.0-migrate_folio-vfs_setxattr.patch b/0002-LU-16328-llite-Linux-6.0-migrate_folio-vfs_setxattr.patch deleted file mode 100644 index 5852d02dfeb42aa0e4b09e321b15e04e30313841..0000000000000000000000000000000000000000 --- a/0002-LU-16328-llite-Linux-6.0-migrate_folio-vfs_setxattr.patch +++ /dev/null @@ -1,273 +0,0 @@ -From 3887e778a97d1b9c5f039252650e75d22a4a7692 Mon Sep 17 00:00:00 2001 -From: Shaun Tancheff -Date: Sat, 14 Jan 2023 02:42:19 -0600 -Subject: [PATCH 2/5] LU-16328 llite: Linux 6.0 migrate_folio, vfs_setxattr - -Linux commit v5.19-rc3-392-g5490da4f06d1 - fs: Add aops->migrate_folio - -Linux commit v5.19-rc4-52-ge33c267ab70d - mm: shrinkers: provide shrinkers with names - -From Linux commit v5.19-rc5-17-g0c5fd887d2bb - acl: move idmapped mount fixup into vfs_{g,s}etxattr() -Until Linux commit v6.0-rc3-6-g6344e66970c6 - xattr: constify value argument in vfs_setxattr() -Cast away const when required. - -Linux commit v5.19-10313-geba2d3d79829 - get rid of non-advancing variants -iov_iter_get_pages_alloc2() replaces iov_iter_get_pages_alloc() - -Test-Parameters: trivial -HPE-bug-id: LUS-11358 -Signed-off-by: Shaun Tancheff -Change-Id: Id1fa6db94172c0a61008ba4b066907950bdd6473 ---- - lustre/autoconf/lustre-core.m4 | 118 +++++++++++++++++++++++++++++++++ - lustre/include/lustre_compat.h | 14 +++- - lustre/llite/rw26.c | 28 ++++++-- - 3 files changed, 154 insertions(+), 6 deletions(-) - -diff --git a/lustre/autoconf/lustre-core.m4 b/lustre/autoconf/lustre-core.m4 -index 984ea8bcc7..f01f22a265 100644 ---- a/lustre/autoconf/lustre-core.m4 -+++ b/lustre/autoconf/lustre-core.m4 -@@ -3246,6 +3246,112 @@ AC_DEFUN([LC_HAVE_ADDRESS_SPACE_OPERATIONS_RELEASE_FOLIO], [ - ]) - ]) # LC_HAVE_ADDRESS_SPACE_OPERATIONS_RELEASE_FOLIO - -+# -+# LC_HAVE_ADDRESS_SPACE_OPERATIONS_MIGRATE_FOLIO -+# -+# Linux commit v5.19-rc3-392-g5490da4f06d1 -+# fs: Add aops->migrate_folio -+# -+AC_DEFUN([LC_SRC_HAVE_ADDRESS_SPACE_OPERATIONS_MIGRATE_FOLIO], [ -+ LB2_LINUX_TEST_SRC([address_space_operations_migrate_folio], [ -+ #include -+ ],[ -+ struct address_space_operations *aops = NULL; -+ struct address_space *m = NULL; -+ struct folio *src = NULL; -+ struct folio *dst = NULL; -+ int err = aops->migrate_folio(m, dst, src, MIGRATE_ASYNC); -+ (void)err; -+ ],[-Werror]) -+]) -+AC_DEFUN([LC_HAVE_ADDRESS_SPACE_OPERATIONS_MIGRATE_FOLIO], [ -+ AC_MSG_CHECKING([if struct address_space_operations() has migrate_folio()]) -+ LB2_LINUX_TEST_RESULT([address_space_operations_migrate_folio], [ -+ AC_DEFINE(HAVE_AOPS_MIGRATE_FOLIO, 1, -+ [struct address_space_operations() has migrate_folio()]) -+ ]) -+]) # LC_HAVE_ADDRESS_SPACE_OPERATIONS_MIGRATE_FOLIO -+ -+# -+# LC_REGISTER_SHRINKER_FORMAT_NAMED -+# -+# Linux commit v5.19-rc4-52-ge33c267ab70d -+# mm: shrinkers: provide shrinkers with names -+# -+AC_DEFUN([LC_SRC_REGISTER_SHRINKER_FORMAT_NAMED], [ -+ LB2_LINUX_TEST_SRC([register_shrinker_format], [ -+ #include -+ ],[ -+ if (register_shrinker(NULL, "lustre-%ps", __func__)) -+ unregister_shrinker(NULL); -+ ],[-Werror]) -+]) -+AC_DEFUN([LC_REGISTER_SHRINKER_FORMAT_NAMED], [ -+ AC_MSG_CHECKING([if register_shrinker() returns status]) -+ LB2_LINUX_TEST_RESULT([address_space_operations_migrate_folio], [ -+ AC_DEFINE(HAVE_REGISTER_SHRINKER_FORMAT_NAMED, 1, -+ [register_shrinker() returns status]) -+ ]) -+]) # LC_REGISTER_SHRINKER_FORMAT_NAMED -+ -+# -+# LC_HAVE_VFS_SETXATTR_NON_CONST_VALUE -+# -+# From Linux commit v5.19-rc5-17-g0c5fd887d2bb -+# acl: move idmapped mount fixup into vfs_{g,s}etxattr() -+# Until Linux commit v6.0-rc3-6-g6344e66970c6 -+# xattr: constify value argument in vfs_setxattr() -+# -+AC_DEFUN([LC_SRC_HAVE_VFS_SETXATTR_NON_CONST_VALUE], [ -+ LB2_LINUX_TEST_SRC([vfs_setxattr_non_const_value_arg], [ -+ #include -+ ],[ -+ struct dentry *de = NULL; -+ const char *name = "an.xattr"; -+ const void *value = NULL; -+ int err = vfs_setxattr(&init_user_ns, de, name, value, 0, 0); -+ (void)err; -+ ],[-Werror]) -+]) # LC_HAVE_VFS_SETXATTR_NON_CONST_VALUE -+AC_DEFUN([LC_HAVE_VFS_SETXATTR_NON_CONST_VALUE], [ -+ AC_MSG_CHECKING([if vfs_setxattr() value argument is non-const]) -+ LB2_LINUX_TEST_RESULT([vfs_setxattr_non_const_value_arg], [ -+ AC_DEFINE([VFS_SETXATTR_VALUE(value)], -+ [(value)], -+ [vfs_setxattr() value argument is const void *]) -+ ],[ -+ AC_DEFINE([VFS_SETXATTR_VALUE(value)], -+ [((void *)(value))], -+ [vfs_setxattr() value argument is non-const]) -+ ]) -+]) # LC_HAVE_VFS_SETXATTR_NON_CONST_VALUE -+ -+# -+# LC_HAVE_IOV_ITER_GET_PAGES_ALLOC2 -+# -+# Linux commit v5.19-10313-geba2d3d79829 -+# get rid of non-advancing variants -+# -+AC_DEFUN([LC_SRC_HAVE_IOV_ITER_GET_PAGES_ALLOC2], [ -+ LB2_LINUX_TEST_SRC([iov_iter_get_pages_alloc2], [ -+ #include -+ ],[ -+ struct iov_iter *iter = NULL; -+ struct page ***pages = NULL; -+ size_t maxsize = 1; -+ size_t start; -+ size_t result __attribute__ ((unused)); -+ result = iov_iter_get_pages_alloc2(iter, pages, maxsize, &start); -+ ],[-Werror]) -+]) -+AC_DEFUN([LC_HAVE_IOV_ITER_GET_PAGES_ALLOC2], [ -+ AC_MSG_CHECKING([if iov_iter_get_pages_alloc2() is available]) -+ LB2_LINUX_TEST_RESULT([iov_iter_get_pages_alloc2], [ -+ AC_DEFINE(HAVE_IOV_ITER_GET_PAGES_ALLOC2, 1, -+ [iov_iter_get_pages_alloc2() is available]) -+ ]) -+]) # LC_HAVE_IOV_ITER_GET_PAGES_ALLOC2 -+ - # - # LC_PROG_LINUX - # -@@ -3466,6 +3572,12 @@ AC_DEFUN([LC_PROG_LINUX_SRC], [ - LC_SRC_HAVE_READ_CACHE_PAGE_FILLER_WITH_FILE - LC_SRC_HAVE_ADDRESS_SPACE_OPERATIONS_RELEASE_FOLIO - -+ # 6.0 -+ LC_SRC_HAVE_ADDRESS_SPACE_OPERATIONS_MIGRATE_FOLIO -+ LC_SRC_REGISTER_SHRINKER_FORMAT_NAMED -+ LC_SRC_HAVE_VFS_SETXATTR_NON_CONST_VALUE -+ LC_SRC_HAVE_IOV_ITER_GET_PAGES_ALLOC2 -+ - # kernel patch to extend integrity interface - LC_SRC_BIO_INTEGRITY_PREP_FN - ]) -@@ -3696,6 +3808,12 @@ AC_DEFUN([LC_PROG_LINUX_RESULTS], [ - LC_HAVE_READ_CACHE_PAGE_FILLER_WITH_FILE - LC_HAVE_ADDRESS_SPACE_OPERATIONS_RELEASE_FOLIO - -+ # 6.0 -+ LC_HAVE_ADDRESS_SPACE_OPERATIONS_MIGRATE_FOLIO -+ LC_REGISTER_SHRINKER_FORMAT_NAMED -+ LC_HAVE_VFS_SETXATTR_NON_CONST_VALUE -+ LC_HAVE_IOV_ITER_GET_PAGES_ALLOC2 -+ - # kernel patch to extend integrity interface - LC_BIO_INTEGRITY_PREP_FN - ]) -diff --git a/lustre/include/lustre_compat.h b/lustre/include/lustre_compat.h -index cfb6e03856..726d99fe9a 100644 ---- a/lustre/include/lustre_compat.h -+++ b/lustre/include/lustre_compat.h -@@ -505,12 +505,20 @@ static inline int ll_vfs_getxattr(struct dentry *dentry, struct inode *inode, - #endif - } - -+/* -+ * v5.19-rc5-17-g0c5fd887d2bb -+ * acl: move idmapped mount fixup into vfs_{g,s}etxattr() -+ * -+ * v6.0-rc3-6-g6344e66970c6 -+ * xattr: constify value argument in vfs_setxattr() -+ */ - static inline int ll_vfs_setxattr(struct dentry *dentry, struct inode *inode, - const char *name, - const void *value, size_t size, int flags) - { - #ifdef HAVE_USER_NAMESPACE_ARG -- return vfs_setxattr(&init_user_ns, dentry, name, value, size, flags); -+ return vfs_setxattr(&init_user_ns, dentry, name, -+ VFS_SETXATTR_VALUE(value), size, flags); - #elif defined(HAVE_VFS_SETXATTR) - return __vfs_setxattr(dentry, inode, name, value, size, flags); - #else -@@ -559,7 +567,9 @@ static inline bool is_root_inode(struct inode *inode) - } - #endif - --#ifndef HAVE_REGISTER_SHRINKER_RET -+#ifdef HAVE_REGISTER_SHRINKER_FORMAT_NAMED -+#define register_shrinker(_s) register_shrinker((_s), "%ps", (_s)) -+#elif !defined(HAVE_REGISTER_SHRINKER_RET) - #define register_shrinker(_s) (register_shrinker(_s), 0) - #endif - -diff --git a/lustre/llite/rw26.c b/lustre/llite/rw26.c -index f4c79def2c..b24b5ea517 100644 ---- a/lustre/llite/rw26.c -+++ b/lustre/llite/rw26.c -@@ -304,8 +304,15 @@ static ssize_t ll_get_user_pages(int rw, struct iov_iter *iter, - /* - * iov_iter_get_pages_alloc() is introduced in 3.16 similar - * to HAVE_DIO_ITER. -+ * Linux commit v5.19-10313-geba2d3d79829 -+ * get rid of non-advancing variants -+ * iov_iter_get_pages_alloc() -> iov_iter_get_pages_alloc2() - */ -+#ifdef HAVE_IOV_ITER_GET_PAGES_ALLOC2 -+ result = iov_iter_get_pages_alloc2(iter, pages, maxsize, &start); -+#else - result = iov_iter_get_pages_alloc(iter, pages, maxsize, &start); -+#endif - if (result > 0) - *npages = DIV_ROUND_UP(result + start, PAGE_SIZE); - -@@ -1035,13 +1042,24 @@ out: - RETURN(result >= 0 ? copied : result); - } - --#ifdef CONFIG_MIGRATION -+#ifdef HAVE_AOPS_MIGRATE_FOLIO -+/* -+ * Linux commit v5.19-rc3-392-g5490da4f06d1 -+ * fs: Add aops->migrate_folio -+ */ -+static int ll_migrate_folio(struct address_space *mapping, struct folio *dst, -+ struct folio *src, enum migrate_mode mode) -+{ -+ /* Always fail page migration until we have a proper implementation */ -+ return -EIO; -+} -+#elif defined(CONFIG_MIGRATION) - static int ll_migratepage(struct address_space *mapping, - struct page *newpage, struct page *page, - enum migrate_mode mode) - { -- /* Always fail page migration until we have a proper implementation */ -- return -EIO; -+ /* Always fail page migration until we have a proper implementation */ -+ return -EIO; - } - #endif - -@@ -1071,7 +1089,9 @@ const struct address_space_operations ll_aops = { - .writepages = ll_writepages, - .write_begin = ll_write_begin, - .write_end = ll_write_end, --#ifdef CONFIG_MIGRATION -+#ifdef HAVE_AOPS_MIGRATE_FOLIO -+ .migrate_folio = ll_migrate_folio, -+#elif defined(CONFIG_MIGRATION) - .migratepage = ll_migratepage, - #endif - }; --- -2.39.1 - diff --git a/0003-LU-16351-llite-Linux-6.1-prandom-folios_contig-vma_i.patch b/0003-LU-16351-llite-Linux-6.1-prandom-folios_contig-vma_i.patch deleted file mode 100644 index e6e13b138da9c92c5aa25fdcdfddfcd2b3f1f555..0000000000000000000000000000000000000000 --- a/0003-LU-16351-llite-Linux-6.1-prandom-folios_contig-vma_i.patch +++ /dev/null @@ -1,621 +0,0 @@ -From 344c33e14c46a74426f31e5a47d282901b8a47a3 Mon Sep 17 00:00:00 2001 -From: Shaun Tancheff -Date: Fri, 27 Jan 2023 00:54:42 -0600 -Subject: [PATCH 3/5] LU-16351 llite: Linux 6.1 prandom, folios_contig, - vma_iterator - -Linux commit v4.10-rc3-6-gc440408cf690 - random: convert get_random_int/long into get_random_u32/u64 -Linux commit v6.0-11338-gde492c83cae0 - prandom: remove unused functions - -prandom_u32 is a wrapper around get_random_u32, change users -of prandom_u32 to get_random_u32 and provide a fallback -to prandom_u32 when get_random_u32 is not available. - -Linux commit v6.0-rc1-2-g25885a35a720 - Change calling conventions for filldir_t -Add a test for the new filldir_t signature -Provide wrappers for transition from int (error code) to bool - -Linux commit v6.0-rc3-94-g35b471467f88 - filemap: add filemap_get_folios_contig() -Provide a wrapper and fallback to find_get_pages_contig - -Linux commit v6.0-rc3-225-gf39af05949a4 - mm: add VMA iterator -Use vma_iterator and for_each_vma when available. - -Test-Parameters: trivial -HPE-bug-id: LUS-11377 -Signed-off-by: Shaun Tancheff -Change-Id: I23dc23d0252e1995555b6685f5cf7c207edf642b ---- - contrib/scripts/spelling.txt | 3 +- - lustre/autoconf/lustre-core.m4 | 101 ++++++++++++++++++++++++++++++ - lustre/llite/llite_mmap.c | 22 +++++-- - lustre/llite/llite_nfs.c | 51 ++++++++++----- - lustre/llite/vvp_dev.c | 27 +++++++- - lustre/obdclass/llog_test.c | 2 +- - lustre/obdclass/lu_object.c | 2 +- - lustre/obdclass/lu_tgt_descs.c | 8 ++- - lustre/osd-ldiskfs/osd_handler.c | 8 ++- - lustre/osd-ldiskfs/osd_internal.h | 18 ++++++ - lustre/osd-ldiskfs/osd_scrub.c | 61 ++++++++++-------- - 11 files changed, 248 insertions(+), 55 deletions(-) - -diff --git a/contrib/scripts/spelling.txt b/contrib/scripts/spelling.txt -index b79e5a5b70..fa94a23d25 100644 ---- a/contrib/scripts/spelling.txt -+++ b/contrib/scripts/spelling.txt -@@ -84,7 +84,7 @@ CFS_PAGE_MASK||PAGE_MASK - CFS_PAGE_SIZE||PAGE_SIZE - cfs_proc_dir_entry_t||struct proc_dir_entry - cfs_rcu_head_t||struct rcu_head --cfs_rand||prandom_u32 -+cfs_rand||get_random_u32 - cfs_srand||add_device_randomness - cfs_trimwhite||strim - cfs_time_add_64||ktime_add -@@ -197,6 +197,7 @@ PAGE_CACHE_MASK||PAGE_MASK - page_cache_release||put_page - PAGE_CACHE_SHIFT||PAGE_SHIFT - PAGE_CACHE_SIZE||PAGE_SIZE -+prandom_u32||get_random_u32 - return seq_printf||seq_printf - setup_timer||cfs_timer_setup - = seq_printf||seq_printf -diff --git a/lustre/autoconf/lustre-core.m4 b/lustre/autoconf/lustre-core.m4 -index f01f22a265..82f89dc04f 100644 ---- a/lustre/autoconf/lustre-core.m4 -+++ b/lustre/autoconf/lustre-core.m4 -@@ -3352,6 +3352,97 @@ AC_DEFUN([LC_HAVE_IOV_ITER_GET_PAGES_ALLOC2], [ - ]) - ]) # LC_HAVE_IOV_ITER_GET_PAGES_ALLOC2 - -+# -+# LC_HAVE_GET_RANDOM_U32_AND_U64 -+# -+# Linux commit v4.10-rc3-6-gc440408cf690 -+# random: convert get_random_int/long into get_random_u32/u64 -+# Linux commit v6.0-11338-gde492c83cae0 -+# prandom: remove unused functions -+# -+AC_DEFUN([LC_SRC_HAVE_GET_RANDOM_U32_AND_U64], [ -+ LB2_LINUX_TEST_SRC([get_random_u32_and_u64], [ -+ #include -+ ],[ -+ u32 rand32 = get_random_u32(); -+ u64 rand64 = get_random_u64(); -+ (void)rand32; -+ (void)rand64; -+ ],[-Werror]) -+]) -+AC_DEFUN([LC_HAVE_GET_RANDOM_U32_AND_U64], [ -+ AC_MSG_CHECKING([if get_random_u32() and get_random_u64() are available]) -+ LB2_LINUX_TEST_RESULT([get_random_u32_and_u64], [ -+ AC_DEFINE(HAVE_GET_RANDOM_U32_AND_U64, 1, -+ [get_random_[u32|u64] are available]) -+ ],[ -+ AC_DEFINE([get_random_u32()], [prandom_u32()], -+ [get_random_u32() is not available, use prandom_u32]) -+ ]) -+]) # LC_HAVE_GET_RANDOM_U32_AND_U64 -+ -+# -+# LC_NFS_FILLDIR_USE_CTX_RETURN_BOOL -+# -+# Linux commit v6.0-rc1-2-g25885a35a720 -+# Change calling conventions for filldir_t -+# -+AC_DEFUN([LC_SRC_NFS_FILLDIR_USE_CTX_RETURN_BOOL], [ -+ LB2_LINUX_TEST_SRC([filldir_ctx_return_bool], [ -+ #include -+ ],[ -+ bool filldir(struct dir_context *ctx, const char* name, -+ int i, loff_t off, u64 tmp, unsigned temp) -+ { -+ return 0; -+ } -+ -+ struct dir_context ctx = { -+ .actor = filldir, -+ }; -+ -+ ctx.actor(NULL, "test", 0, (loff_t) 0, 0, 0); -+ ],[-Werror]) -+]) -+AC_DEFUN([LC_NFS_FILLDIR_USE_CTX_RETURN_BOOL], [ -+ AC_MSG_CHECKING([if filldir_t uses struct dir_context and returns bool]) -+ LB2_LINUX_TEST_RESULT([filldir_ctx_return_bool], [ -+ AC_DEFINE(HAVE_FILLDIR_USE_CTX_RETURN_BOOL, 1, -+ [filldir_t needs struct dir_context and returns bool]) -+ AC_DEFINE(HAVE_FILLDIR_USE_CTX, 1, -+ [filldir_t needs struct dir_context as argument]) -+ AC_DEFINE(FILLDIR_TYPE, bool, -+ [filldir_t return type is bool or int]) -+ ],[ -+ AC_DEFINE(FILLDIR_TYPE, int, -+ [filldir_t return type is bool or int]) -+ ]) -+]) # LC_NFS_FILLDIR_USE_CTX_RETURN_BOOL -+ -+# -+# LC_HAVE_FILEMAP_GET_FOLIOS_CONTIG -+# -+# Linux commit v6.0-rc3-94-g35b471467f88 -+# filemap: add filemap_get_folios_contig() -+# -+AC_DEFUN([LC_SRC_HAVE_FILEMAP_GET_FOLIOS_CONTIG], [ -+ LB2_LINUX_TEST_SRC([filemap_get_folios_contig], [ -+ #include -+ ],[ -+ struct address_space *m = NULL; -+ pgoff_t start = 0; -+ struct folio_batch *fbatch = NULL; -+ (void)filemap_get_folios_contig(m, &start, ULONG_MAX, fbatch); -+ ],[-Werror]) -+]) -+AC_DEFUN([LC_HAVE_FILEMAP_GET_FOLIOS_CONTIG], [ -+ AC_MSG_CHECKING([if filemap_get_folios_contig() is available]) -+ LB2_LINUX_TEST_RESULT([filldir_ctx_return_bool], [ -+ AC_DEFINE(HAVE_FILEMAP_GET_FOLIOS_CONTIG, 1, -+ [filemap_get_folios_contig() is available]) -+ ]) -+]) # LC_HAVE_FILEMAP_GET_FOLIOS_CONTIG -+ - # - # LC_PROG_LINUX - # -@@ -3578,6 +3669,11 @@ AC_DEFUN([LC_PROG_LINUX_SRC], [ - LC_SRC_HAVE_VFS_SETXATTR_NON_CONST_VALUE - LC_SRC_HAVE_IOV_ITER_GET_PAGES_ALLOC2 - -+ # 6.1 -+ LC_SRC_HAVE_GET_RANDOM_U32_AND_U64 -+ LC_SRC_NFS_FILLDIR_USE_CTX_RETURN_BOOL -+ LC_SRC_HAVE_FILEMAP_GET_FOLIOS_CONTIG -+ - # kernel patch to extend integrity interface - LC_SRC_BIO_INTEGRITY_PREP_FN - ]) -@@ -3814,6 +3910,11 @@ AC_DEFUN([LC_PROG_LINUX_RESULTS], [ - LC_HAVE_VFS_SETXATTR_NON_CONST_VALUE - LC_HAVE_IOV_ITER_GET_PAGES_ALLOC2 - -+ # 6.1 -+ LC_HAVE_GET_RANDOM_U32_AND_U64 -+ LC_NFS_FILLDIR_USE_CTX_RETURN_BOOL -+ LC_HAVE_FILEMAP_GET_FOLIOS_CONTIG -+ - # kernel patch to extend integrity interface - LC_BIO_INTEGRITY_PREP_FN - ]) -diff --git a/lustre/llite/llite_mmap.c b/lustre/llite/llite_mmap.c -index af70ae68ba..7b95d6b49b 100644 ---- a/lustre/llite/llite_mmap.c -+++ b/lustre/llite/llite_mmap.c -@@ -51,18 +51,32 @@ void policy_from_vma(union ldlm_policy_data *policy, struct vm_area_struct *vma, - ~PAGE_MASK; - } - -+/* -+ * Linux commit v6.0-rc3-225-gf39af05949a4 -+ * mm: add VMA iterator -+ */ -+#ifndef VMA_ITERATOR -+#define vma_iterator vm_area_struct * -+#define vma_iter_init(vmip, mm, addr) *(vmip) = find_vma(mm, addr) -+#define for_each_vma(vmi, vma) \ -+ for (vma = vmi; vma != NULL; vma = vma->vm_next) -+#endif -+ - struct vm_area_struct *our_vma(struct mm_struct *mm, unsigned long addr, -- size_t count) -+ size_t count) - { - struct vm_area_struct *vma, *ret = NULL; -+ struct vma_iterator vmi; -+ - ENTRY; - - /* mmap_lock must have been held by caller. */ - LASSERT(!mmap_write_trylock(mm)); - -- for (vma = find_vma(mm, addr); -- vma != NULL && vma->vm_start < (addr + count); -- vma = vma->vm_next) { -+ vma_iter_init(&vmi, mm, addr); -+ for_each_vma(vmi, vma) { -+ if (vma->vm_start < (addr + count)) -+ break; - if (vma->vm_ops && vma->vm_ops == &ll_file_vm_ops && - vma->vm_flags & VM_SHARED) { - ret = vma; -diff --git a/lustre/llite/llite_nfs.c b/lustre/llite/llite_nfs.c -index 644aac2456..7d16d9d165 100644 ---- a/lustre/llite/llite_nfs.c -+++ b/lustre/llite/llite_nfs.c -@@ -198,19 +198,10 @@ static int ll_encode_fh(struct inode *inode, u32 *fh, int *plen, - RETURN(FILEID_LUSTRE); - } - --static int --#ifndef HAVE_FILLDIR_USE_CTX --ll_nfs_get_name_filldir(void *cookie, const char *name, int namelen, -- loff_t hash, u64 ino, unsigned type) -+static inline int -+do_nfs_get_name_filldir(struct ll_getname_data *lgd, const char *name, -+ int namelen, loff_t hash, u64 ino, unsigned int type) - { -- struct ll_getname_data *lgd = cookie; --#else --ll_nfs_get_name_filldir(struct dir_context *ctx, const char *name, int namelen, -- loff_t hash, u64 ino, unsigned type) --{ -- struct ll_getname_data *lgd = -- container_of(ctx, struct ll_getname_data, ctx); --#endif /* HAVE_FILLDIR_USE_CTX */ - /* - * It is hack to access lde_fid for comparison with lgd_fid. - * So the input 'name' must be part of the 'lu_dirent', and -@@ -232,11 +223,41 @@ ll_nfs_get_name_filldir(struct dir_context *ctx, const char *name, int namelen, - lgd->lgd_name[namelen] = 0; - lgd->lgd_found = 1; - } -- return lgd->lgd_found; -+ return lgd->lgd_found; -+} -+ -+#ifdef HAVE_FILLDIR_USE_CTX_RETURN_BOOL -+static bool -+ll_nfs_get_name_filldir(struct dir_context *ctx, const char *name, int namelen, -+ loff_t hash, u64 ino, unsigned int type) -+{ -+ struct ll_getname_data *lgd = -+ container_of(ctx, struct ll_getname_data, ctx); -+ int err = do_nfs_get_name_filldir(lgd, name, namelen, hash, ino, type); -+ -+ return err == 0; -+} -+#elif defined(HAVE_FILLDIR_USE_CTX) -+static int -+ll_nfs_get_name_filldir(struct dir_context *ctx, const char *name, int namelen, -+ loff_t hash, u64 ino, unsigned int type) -+{ -+ struct ll_getname_data *lgd = -+ container_of(ctx, struct ll_getname_data, ctx); -+ -+ return do_nfs_get_name_filldir(lgd, name, namelen, hash, ino, type); - } -+#else -+static int ll_nfs_get_name_filldir(void *cookie, const char *name, int namelen, -+ loff_t hash, u64 ino, unsigned int type) -+{ -+ struct ll_getname_data *lgd = cookie; -+ -+ return do_nfs_get_name_filldir(lgd, name, namelen, hash, ino, type); -+} -+#endif /* HAVE_FILLDIR_USE_CTX */ - --static int ll_get_name(struct dentry *dentry, char *name, -- struct dentry *child) -+static int ll_get_name(struct dentry *dentry, char *name, struct dentry *child) - { - struct inode *dir = dentry->d_inode; - struct ll_getname_data lgd = { -diff --git a/lustre/llite/vvp_dev.c b/lustre/llite/vvp_dev.c -index 0a2fc5b25b..4036afce63 100644 ---- a/lustre/llite/vvp_dev.c -+++ b/lustre/llite/vvp_dev.c -@@ -386,6 +386,28 @@ struct vvp_seq_private { - loff_t vvp_prev_pos; - }; - -+unsigned int ll_filemap_get_one_page_contig(struct address_space *mapping, -+ pgoff_t start, struct page **pg) -+{ -+#ifdef HAVE_FILEMAP_GET_FOLIOS_CONTIG -+ struct folio_batch fbatch; -+ int nr; -+ -+ folio_batch_init(&fbatch); -+ *pg = NULL; -+ -+ nr = filemap_get_folios_contig(mapping, &start, start, &fbatch); -+ if (nr == PAGEVEC_SIZE) { -+ --nr; -+ *pg = folio_page(fbatch.folios[nr], 0); -+ return 1; -+ } -+ return 0; -+#else /* !HAVE_FILEMAP_GET_FOLIOS_CONTIG */ -+ return find_get_pages_contig(mapping, start, 1, pg); -+#endif -+} -+ - static struct page *vvp_pgcache_current(struct vvp_seq_private *priv) - { - struct lu_device *dev = &priv->vsp_sbi->ll_cl->cd_lu_dev; -@@ -416,8 +438,9 @@ static struct page *vvp_pgcache_current(struct vvp_seq_private *priv) - } - - inode = vvp_object_inode(priv->vsp_clob); -- nr = find_get_pages_contig(inode->i_mapping, -- priv->vsp_page_index, 1, &vmpage); -+ nr = ll_filemap_get_one_page_contig(inode->i_mapping, -+ priv->vsp_page_index, -+ &vmpage); - if (nr > 0) { - priv->vsp_page_index = vmpage->index; - break; -diff --git a/lustre/obdclass/llog_test.c b/lustre/obdclass/llog_test.c -index 1a7cbdea7c..6b32d80e00 100644 ---- a/lustre/obdclass/llog_test.c -+++ b/lustre/obdclass/llog_test.c -@@ -2325,7 +2325,7 @@ static int llog_test_setup(struct obd_device *obd, struct lustre_cfg *lcfg) - ctxt->loc_dir = o; - llog_ctxt_put(ctxt); - -- llog_test_rand = prandom_u32(); -+ llog_test_rand = get_random_u32(); - - rc = llog_run_tests(&env, tgt); - if (rc) -diff --git a/lustre/obdclass/lu_object.c b/lustre/obdclass/lu_object.c -index d2fbbd9087..5389a86620 100644 ---- a/lustre/obdclass/lu_object.c -+++ b/lustre/obdclass/lu_object.c -@@ -1135,7 +1135,7 @@ int lu_site_init(struct lu_site *s, struct lu_device *top) - return -ENOMEM; - } - -- s->ls_bkt_seed = prandom_u32(); -+ s->ls_bkt_seed = get_random_u32(); - s->ls_bkt_cnt = max_t(long, 1 << LU_SITE_BKT_BITS, - 2 * num_possible_cpus()); - s->ls_bkt_cnt = roundup_pow_of_two(s->ls_bkt_cnt); -diff --git a/lustre/obdclass/lu_tgt_descs.c b/lustre/obdclass/lu_tgt_descs.c -index bfb5816430..fafbdfea27 100644 ---- a/lustre/obdclass/lu_tgt_descs.c -+++ b/lustre/obdclass/lu_tgt_descs.c -@@ -57,7 +57,9 @@ u64 lu_prandom_u64_max(u64 ep_ro) - u64 rand = 0; - - if (ep_ro) { --#if BITS_PER_LONG == 32 -+#ifdef HAVE_GET_RANDOM_U32_AND_U64 -+ rand = get_random_u64() % ep_ro; -+#elif BITS_PER_LONG == 32 - /* - * If ep_ro > 32-bit, first generate the high - * 32 bits of the random number, then add in the low -@@ -69,9 +71,9 @@ u64 lu_prandom_u64_max(u64 ep_ro) - if (rand == (ep_ro & 0xffffffff00000000ULL)) - rand |= prandom_u32_max((u32)ep_ro); - else -- rand |= prandom_u32(); -+ rand |= get_random_u32(); - #else -- rand = ((u64)prandom_u32() << 32 | prandom_u32()) % ep_ro; -+ rand = ((u64)get_random_u32() << 32 | get_random_u32()) % ep_ro; - #endif - } - -diff --git a/lustre/osd-ldiskfs/osd_handler.c b/lustre/osd-ldiskfs/osd_handler.c -index bb573827c5..67962fa67a 100644 ---- a/lustre/osd-ldiskfs/osd_handler.c -+++ b/lustre/osd-ldiskfs/osd_handler.c -@@ -910,7 +910,7 @@ struct osd_check_lmv_buf { - * \retval -ve for failure - */ - #ifdef HAVE_FILLDIR_USE_CTX --static int osd_stripe_dir_filldir(struct dir_context *buf, -+static FILLDIR_TYPE do_osd_stripe_dir_filldir(struct dir_context *buf, - #else - static int osd_stripe_dir_filldir(void *buf, - #endif -@@ -950,6 +950,8 @@ static int osd_stripe_dir_filldir(void *buf, - return 1; - } - -+WRAP_FILLDIR_FN(do_, osd_stripe_dir_filldir) -+ - /* - * When lookup item under striped directory, we need to locate the master - * MDT-object of the striped directory firstly, then the client will send -@@ -6961,7 +6963,7 @@ struct osd_filldir_cbs { - * \retval 1 on buffer full - */ - #ifdef HAVE_FILLDIR_USE_CTX --static int osd_ldiskfs_filldir(struct dir_context *ctx, -+static FILLDIR_TYPE do_osd_ldiskfs_filldir(struct dir_context *ctx, - #else - static int osd_ldiskfs_filldir(void *ctx, - #endif -@@ -7033,6 +7035,8 @@ static int osd_ldiskfs_filldir(void *ctx, - RETURN(0); - } - -+WRAP_FILLDIR_FN(do_, osd_ldiskfs_filldir) -+ - /** - * Calls ->iterate*() to load a directory entry at a time - * and stored it in iterator's in-memory data structure. -diff --git a/lustre/osd-ldiskfs/osd_internal.h b/lustre/osd-ldiskfs/osd_internal.h -index 1ee407e1f3..c783d3b923 100644 ---- a/lustre/osd-ldiskfs/osd_internal.h -+++ b/lustre/osd-ldiskfs/osd_internal.h -@@ -1727,4 +1727,22 @@ static inline bool bdev_integrity_enabled(struct block_device *bdev, int rw) - return false; - } - -+#ifdef HAVE_FILLDIR_USE_CTX_RETURN_BOOL -+#define WRAP_FILLDIR_FN(prefix, fill_fn) \ -+static bool fill_fn(struct dir_context *buf, const char *name, int namelen, \ -+ loff_t offset, __u64 ino, unsigned int d_type) \ -+{ \ -+ return !prefix##fill_fn(buf, name, namelen, offset, ino, d_type); \ -+} -+#elif defined(HAVE_FILLDIR_USE_CTX) -+#define WRAP_FILLDIR_FN(prefix, fill_fn) \ -+static int fill_fn(struct dir_context *buf, const char *name, int namelen, \ -+ loff_t offset, __u64 ino, unsigned int d_type) \ -+{ \ -+ return prefix##fill_fn(buf, name, namelen, offset, ino, d_type); \ -+} -+#else -+#define WRAP_FILLDIR_FN(prefix, fill_fn) -+#endif -+ - #endif /* _OSD_INTERNAL_H */ -diff --git a/lustre/osd-ldiskfs/osd_scrub.c b/lustre/osd-ldiskfs/osd_scrub.c -index 8c400ed170..ceee333fe3 100644 ---- a/lustre/osd-ldiskfs/osd_scrub.c -+++ b/lustre/osd-ldiskfs/osd_scrub.c -@@ -1360,27 +1360,30 @@ typedef int (*scandir_t)(struct osd_thread_info *, struct osd_device *, - struct dentry *, filldir_t filldir); - - #ifdef HAVE_FILLDIR_USE_CTX --static int osd_ios_varfid_fill(struct dir_context *buf, const char *name, -- int namelen, loff_t offset, __u64 ino, -- unsigned d_type); --static int osd_ios_lf_fill(struct dir_context *buf, const char *name, -- int namelen, loff_t offset, __u64 ino, -- unsigned d_type); --static int osd_ios_dl_fill(struct dir_context *buf, const char *name, -- int namelen, loff_t offset, __u64 ino, -- unsigned d_type); --static int osd_ios_uld_fill(struct dir_context *buf, const char *name, -- int namelen, loff_t offset, __u64 ino, -- unsigned d_type); -+static FILLDIR_TYPE -+osd_ios_varfid_fill(struct dir_context *buf, const char *name, int namelen, -+ loff_t offset, __u64 ino, unsigned int d_type); -+ -+static FILLDIR_TYPE -+osd_ios_lf_fill(struct dir_context *buf, const char *name, int namelen, -+ loff_t offset, __u64 ino, unsigned int d_type); -+ -+static FILLDIR_TYPE -+osd_ios_dl_fill(struct dir_context *buf, const char *name, int namelen, -+ loff_t offset, __u64 ino, unsigned int d_type); -+ -+static FILLDIR_TYPE -+osd_ios_uld_fill(struct dir_context *buf, const char *name, int namelen, -+ loff_t offset, __u64 ino, unsigned int d_type); - #else - static int osd_ios_varfid_fill(void *buf, const char *name, int namelen, -- loff_t offset, __u64 ino, unsigned d_type); -+ loff_t offset, __u64 ino, unsigned int d_type); - static int osd_ios_lf_fill(void *buf, const char *name, int namelen, -- loff_t offset, __u64 ino, unsigned d_type); -+ loff_t offset, __u64 ino, unsigned int d_type); - static int osd_ios_dl_fill(void *buf, const char *name, int namelen, -- loff_t offset, __u64 ino, unsigned d_type); -+ loff_t offset, __u64 ino, unsigned int d_type); - static int osd_ios_uld_fill(void *buf, const char *name, int namelen, -- loff_t offset, __u64 ino, unsigned d_type); -+ loff_t offset, __u64 ino, unsigned int d_type); - #endif - - static int -@@ -2009,12 +2012,12 @@ osd_ios_scan_one(struct osd_thread_info *info, struct osd_device *dev, - * or filter_fid_18_23), move them back to its proper /O//d. - */ - #ifdef HAVE_FILLDIR_USE_CTX --static int osd_ios_lf_fill(struct dir_context *buf, -+static FILLDIR_TYPE do_osd_ios_lf_fill(struct dir_context *buf, - #else - static int osd_ios_lf_fill(void *buf, - #endif - const char *name, int namelen, -- loff_t offset, __u64 ino, unsigned d_type) -+ loff_t offset, __u64 ino, unsigned int d_type) - { - struct osd_ios_filldir_buf *fill_buf = - (struct osd_ios_filldir_buf *)buf; -@@ -2089,14 +2092,15 @@ put: - /* skip the failure to make the scanning to continue. */ - return 0; - } -+WRAP_FILLDIR_FN(do_, osd_ios_lf_fill) - - #ifdef HAVE_FILLDIR_USE_CTX --static int osd_ios_varfid_fill(struct dir_context *buf, -+static FILLDIR_TYPE do_osd_ios_varfid_fill(struct dir_context *buf, - #else - static int osd_ios_varfid_fill(void *buf, - #endif - const char *name, int namelen, -- loff_t offset, __u64 ino, unsigned d_type) -+ loff_t offset, __u64 ino, unsigned int d_type) - { - struct osd_ios_filldir_buf *fill_buf = - (struct osd_ios_filldir_buf *)buf; -@@ -2125,14 +2129,15 @@ static int osd_ios_varfid_fill(void *buf, - - RETURN(rc); - } -+WRAP_FILLDIR_FN(do_, osd_ios_varfid_fill) - - #ifdef HAVE_FILLDIR_USE_CTX --static int osd_ios_dl_fill(struct dir_context *buf, -+static FILLDIR_TYPE do_osd_ios_dl_fill(struct dir_context *buf, - #else - static int osd_ios_dl_fill(void *buf, - #endif - const char *name, int namelen, -- loff_t offset, __u64 ino, unsigned d_type) -+ loff_t offset, __u64 ino, unsigned int d_type) - { - struct osd_ios_filldir_buf *fill_buf = - (struct osd_ios_filldir_buf *)buf; -@@ -2170,14 +2175,15 @@ static int osd_ios_dl_fill(void *buf, - - RETURN(rc); - } -+WRAP_FILLDIR_FN(do_, osd_ios_dl_fill) - - #ifdef HAVE_FILLDIR_USE_CTX --static int osd_ios_uld_fill(struct dir_context *buf, -+static FILLDIR_TYPE do_osd_ios_uld_fill(struct dir_context *buf, - #else - static int osd_ios_uld_fill(void *buf, - #endif - const char *name, int namelen, -- loff_t offset, __u64 ino, unsigned d_type) -+ loff_t offset, __u64 ino, unsigned int d_type) - { - struct osd_ios_filldir_buf *fill_buf = - (struct osd_ios_filldir_buf *)buf; -@@ -2209,14 +2215,15 @@ static int osd_ios_uld_fill(void *buf, - - RETURN(rc); - } -+WRAP_FILLDIR_FN(do_, osd_ios_uld_fill) - - #ifdef HAVE_FILLDIR_USE_CTX --static int osd_ios_root_fill(struct dir_context *buf, -+static FILLDIR_TYPE do_osd_ios_root_fill(struct dir_context *buf, - #else - static int osd_ios_root_fill(void *buf, - #endif - const char *name, int namelen, -- loff_t offset, __u64 ino, unsigned d_type) -+ loff_t offset, __u64 ino, unsigned int d_type) - { - struct osd_ios_filldir_buf *fill_buf = - (struct osd_ios_filldir_buf *)buf; -@@ -2262,6 +2269,8 @@ out_put: - RETURN(rc); - } - -+WRAP_FILLDIR_FN(do_, osd_ios_root_fill) -+ - static int - osd_ios_general_scan(struct osd_thread_info *info, struct osd_device *dev, - struct dentry *dentry, filldir_t filldir) --- -2.39.1 - diff --git a/0004-LU-16662-autoconf-fix-configure-test-compile-for-CON.patch b/0004-LU-16662-autoconf-fix-configure-test-compile-for-CON.patch deleted file mode 100644 index 832c365d7d4a0ecfe89480b1e7b5fe68cf70c88a..0000000000000000000000000000000000000000 --- a/0004-LU-16662-autoconf-fix-configure-test-compile-for-CON.patch +++ /dev/null @@ -1,70 +0,0 @@ -From 240d04b6a55bff2e4dfc0e1de6ce2bbfa85e9d70 Mon Sep 17 00:00:00 2001 -From: Xinliang Liu -Date: Fri, 24 Mar 2023 07:16:10 +0000 -Subject: [PATCH 4/5] LU-16662 autoconf: fix configure test compile for - CONFIG_KEYS - -This fixes below configure error on Linux v5.19+: -$ ./configure --disable-server -... -checking whether to enable gss keyring backend... yes -checking if Linux kernel was built with CONFIG_KEYS in or as module... -no -configure: WARNING: GSS keyring backend requires that CONFIG_KEYS be -enabled in your kernel. -checking for keyctl_search in -lkeyutils... yes -configure: error: Cannot enable gss_keyring. See above for details. -$ grep CONFIG_KEYS -rn /boot/config-* -6884:CONFIG_KEYS=y - -For in-tree IB support and without passing Linux src path when run -./configure, the LINUX_OBJ maybe just a soft link to O2IBPATH, they -are pointing to the same dir. E.g.: -O2IBPATH='/usr/src/kernels/6.1.8-3.0.0.7.oe1.aarch64' -LINUX_OBJ='/lib/modules/6.1.8-3.0.0.7.oe1.aarch64/build' -$ ls -l /lib/modules/6.1.8-3.0.0.7.oe1.aarch64/build -lrwxrwxrwx 1 root root 42 Feb 7 00:00 -/lib/modules/6.1.8-3.0.0.7.oe1.aarch64/build -> -/usr/src/kernels/6.1.8-3.0.0.7.oe1.aarch64 -In this case, current configure will put kernel's Module.symvers to -variable KBUILD_EXTRA_SYMBOLS. This should be avoided after kernel -v5.19 which contains commit "b8422711080f modpost: make multiple export -error". This making multiple export symbol as an error from a warning -which can be seen in the config.log: -... -ERROR: modpost: vmlinux: 'init_uts_ns' exported twice. Previous export -was in vmlinux -... - -Test-Parameters: trivial -Change-Id: I35295b3acc7fffb93716362f5d8c659eb922afcb -Signed-off-by: Xinliang Liu ---- - lnet/autoconf/lustre-lnet.m4 | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/lnet/autoconf/lustre-lnet.m4 b/lnet/autoconf/lustre-lnet.m4 -index 6aff70afd5..8fe90cbdd7 100644 ---- a/lnet/autoconf/lustre-lnet.m4 -+++ b/lnet/autoconf/lustre-lnet.m4 -@@ -245,7 +245,7 @@ AS_IF([test $ENABLEO2IB = "no"], [ - O2IB_SYMVER=$LINUX_OBJ/Module.symvers - fi - if test -n "$O2IB_SYMVER"; then -- if test "$O2IB_SYMVER" != "$LINUX_OBJ/Module.symvers"; then -+ if test !"$O2IB_SYMVER" -ef "$LINUX_OBJ/Module.symvers"; then - AC_MSG_NOTICE([adding $O2IB_SYMVER to Symbol Path O2IB]) - EXTRA_SYMBOLS="$EXTRA_SYMBOLS $O2IB_SYMVER" - AC_SUBST(EXTRA_SYMBOLS) -@@ -286,7 +286,7 @@ AC_SUBST(ENABLEO2IB) - - AS_IF([test $ENABLEO2IB != "no"], [ - EXTRA_CHECK_INCLUDE="$EXTRA_OFED_CONFIG $EXTRA_OFED_INCLUDE" -- if test $O2IBPATH != $LINUX_OBJ; then -+ if test ! $O2IBPATH -ef $LINUX_OBJ; then - KBUILD_EXTRA_SYMBOLS="$KBUILD_EXTRA_SYMBOLS $O2IBPATH/Module.symvers" - fi - --- -2.39.1 - diff --git a/0005-lustre.spec.in-Add-gcc-option-Wno-stringop-overflow.patch b/0005-lustre.spec.in-Add-gcc-option-Wno-stringop-overflow.patch deleted file mode 100644 index 111525093da25cf16a507e2efa8a427d6ea2276e..0000000000000000000000000000000000000000 --- a/0005-lustre.spec.in-Add-gcc-option-Wno-stringop-overflow.patch +++ /dev/null @@ -1,28 +0,0 @@ -From f4fa472941943b9d1b74df40a31c8d697230fa93 Mon Sep 17 00:00:00 2001 -From: Xinliang Liu -Date: Fri, 24 Mar 2023 08:21:06 +0000 -Subject: [PATCH 5/5] lustre.spec.in: Add gcc option -Wno-stringop-overflow - -See openEuler gcc bug: https://gitee.com/openeuler/gcc/issues/I5XMD0 - -Signed-off-by: Xinliang Liu ---- - lustre.spec.in | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/lustre.spec.in b/lustre.spec.in -index 653bc1e291..7b544c23e4 100644 ---- a/lustre.spec.in -+++ b/lustre.spec.in -@@ -476,7 +476,7 @@ export UTILS_CFLAGS="${UTILS_CFLAGS} -D__SANE_USERSPACE_TYPES__=1" - # Disable any hardening or annotation since this doesn't make sense for - # kernel code, and reset "optflags" so that the vendor's overzealous flags don't - # create build failures. --%define optflags -g -O2 -Werror -+%define optflags -g -O2 -Werror -Wno-stringop-overflow - %undefine _annotated_build - %undefine _hardened_build - --- -2.39.1 - diff --git a/2.15.54.tar.gz b/2.15.57.tar.gz similarity index 78% rename from 2.15.54.tar.gz rename to 2.15.57.tar.gz index 193ff91ac59728c82e238e906b7f8e16e77ddc85..0d0d1a9b9836fe05d7a3de830bc54f4757d48cc1 100644 Binary files a/2.15.54.tar.gz and b/2.15.57.tar.gz differ diff --git a/LU-16802-build-iov_iter_iovec-class_create-get_expir.patch b/LU-16802-build-iov_iter_iovec-class_create-get_expir.patch new file mode 100644 index 0000000000000000000000000000000000000000..d8dd89071f916b0e6c56c87a69090cbf6f6e0722 --- /dev/null +++ b/LU-16802-build-iov_iter_iovec-class_create-get_expir.patch @@ -0,0 +1,466 @@ +From 13bab88098587ad08e5b56450a21f34003eaf6d3 Mon Sep 17 00:00:00 2001 +From: Shaun Tancheff +Date: Tue, 11 Jul 2023 18:41:13 +0700 +Subject: [PATCH] LU-16802 build: iov_iter_iovec, class_create, get_expiry + +linux kernel v6.3-rc4-32-g6eb203e1a868 + iov_iter: remove iov_iter_iovec() + +Provide a replacement iov_iter_iovec() when one is not provided. + +linux kernel v6.3-rc4-34-g747b1f65d39a + iov_iter: overlay struct iovec and ubuf/len + +This renames iov_iter member iov to __iov. +Define __iov as iov when __iov not present. + +linux kernel v6.3-rc1-13-g1aaba11da9aa + driver core: class: remove module * from class_create() + +Provide an ll_class_create() to pass THIS_MODULE, or not, +as needed by class_create(). + +Linux commit v6.2-rc1-20-gf861646a6562 + quota: port to mnt_idmap + +Update osd_dquot_transfer to use mnt_idmap and fallback +to user_ns, if needed, by dquot_transfer. + +Linux commit v6.3-rc7-2433-gcf64b9bce950 + SUNRPC: return proper error from get_expiry() + +Updated get_expiry() requires a time64_t pointer to be passed +to hold the expiry time. A non-zero return value indicates an +error, nominally -EINVAL. Provide a wrapper for kernels that +return a time64_t and return -EINVAL on error. + +Test-Parameters: trivial +HPE-bug-id: LUS-11614 +Signed-off-by: Shaun Tancheff +Change-Id: I765d6257eec8b5a9bf1bd5947f03370eb9df1625 +--- + lustre/autoconf/lustre-core.m4 | 117 +++++++++++++++++++++ + lustre/include/lustre_compat.h | 18 ++-- + lustre/mdc/mdc_request.c | 2 +- + lustre/ofd/ofd_access_log.c | 2 +- + lustre/ptlrpc/gss/gss_svc_upcall.c | 159 +++++++++++++++-------------- + 5 files changed, 213 insertions(+), 85 deletions(-) + +diff --git a/lustre/autoconf/lustre-core.m4 b/lustre/autoconf/lustre-core.m4 +index b2b9ebcd86..38c3906abf 100644 +--- a/lustre/autoconf/lustre-core.m4 ++++ b/lustre/autoconf/lustre-core.m4 +@@ -3866,6 +3866,111 @@ AC_DEFUN([LC_HAVE_LOCKS_LOCK_FILE_WAIT_IN_FILELOCK], [ + ]) + ]) # LC_HAVE_LOCKS_LOCK_FILE_WAIT_IN_FILELOCK + ++# ++# LC_HAVE_IOV_ITER_IOVEC ++# ++# linux kernel v6.3-rc4-32-g6eb203e1a868 ++# iov_iter: remove iov_iter_iovec() ++# ++AC_DEFUN([LC_SRC_HAVE_IOV_ITER_IOVEC], [ ++ LB2_LINUX_TEST_SRC([iov_iter_iovec_exists], [ ++ #include ++ ],[ ++ struct iovec iov __attribute__ ((unused)); ++ struct iov_iter i = { }; ++ ++ iov = iov_iter_iovec(&i); ++ ],[-Werror]) ++]) ++AC_DEFUN([LC_HAVE_IOV_ITER_IOVEC], [ ++ AC_MSG_CHECKING([if 'iov_iter_iovec' is available]) ++ LB2_LINUX_TEST_RESULT([iov_iter_iovec_exists], [ ++ AC_DEFINE(HAVE_IOV_ITER_IOVEC, 1, ++ ['iov_iter_iovec' is available]) ++ ]) ++]) # LC_HAVE_IOV_ITER_IOVEC ++ ++# ++# LC_HAVE_IOVEC_WITH_IOV_MEMBER ++# ++# linux kernel v6.3-rc4-34-g747b1f65d39a ++# iov_iter: overlay struct iovec and ubuf/len ++# This renames iov_iter member iov to __iov and now __iov == __ubuf_iovec ++# ++AC_DEFUN([LC_SRC_HAVE_IOVEC_WITH_IOV_MEMBER], [ ++ LB2_LINUX_TEST_SRC([iov_iter_has___iov_member], [ ++ #include ++ ],[ ++ struct iov_iter iter = { }; ++ size_t len __attribute__ ((unused)); ++ ++ len = iter->__iov->iov_len; ++ ],[-Werror]) ++]) ++AC_DEFUN([LC_HAVE_IOVEC_WITH_IOV_MEMBER], [ ++ AC_MSG_CHECKING([if 'iov_iter_iovec' is available]) ++ LB2_LINUX_TEST_RESULT([iov_iter_has___iov_member], [ ++ AC_DEFINE(HAVE___IOV_MEMBER, __iov, ++ ['iov_iter' has '__iov' member]) ++ ],[ ++ AC_DEFINE(__iov, iov, ++ ['iov_iter' has 'iov' member]) ++ ]) ++]) # LC_HAVE_IOVEC_WITH_IOV_MEMBER ++ ++# ++# LC_HAVE_CLASS_CREATE_MODULE_ARG ++# ++# linux kernel v6.3-rc1-13-g1aaba11da9aa ++# driver core: class: remove module * from class_create() ++# ++AC_DEFUN([LC_SRC_HAVE_CLASS_CREATE_MODULE_ARG], [ ++ LB2_LINUX_TEST_SRC([class_create_without_module_arg], [ ++ #include ++ ],[ ++ struct class *class __attribute__ ((unused)); ++ ++ class = class_create("empty"); ++ if (IS_ERR(class)) ++ /* checked */; ++ ],[-Werror]) ++]) ++AC_DEFUN([LC_HAVE_CLASS_CREATE_MODULE_ARG], [ ++ AC_MSG_CHECKING([if 'class_create' does not have module arg]) ++ LB2_LINUX_TEST_RESULT([class_create_without_module_arg], [ ++ AC_DEFINE([ll_class_create(name)], ++ [class_create((name))], ++ ['class_create' does not have module arg]) ++ ],[ ++ AC_DEFINE([ll_class_create(name)], ++ [class_create(THIS_MODULE, (name))], ++ ['class_create' expects module arg]) ++ ]) ++]) # LC_HAVE_IOVEC_WITH_IOV_MEMBER ++ ++# ++# LC_HAVE_GET_EXPIRY_TIME64_T ++# ++# linux kernel v6.3-rc7-2433-gcf64b9bce950 ++# SUNRPC: return proper error from get_expiry() ++# ++AC_DEFUN([LC_SRC_HAVE_GET_EXPIRY_TIME64_T], [ ++ LB2_LINUX_TEST_SRC([get_expiry_with_time64_t], [ ++ #include ++ ],[ ++ int err __attribute__ ((unused)); ++ ++ err = get_expiry((char **)NULL, (time64_t *)NULL); ++ ],[-Werror]) ++]) ++AC_DEFUN([LC_HAVE_GET_EXPIRY_TIME64_T], [ ++ AC_MSG_CHECKING([if 'get_expiry' needs a time64_t arg]) ++ LB2_LINUX_TEST_RESULT([get_expiry_with_time64_t], [ ++ AC_DEFINE(HAVE_GET_EXPIRY_2ARGS, 1, ++ ['get_expiry' takes time64_t]) ++ ]) ++]) # LC_HAVE_IOVEC_WITH_IOV_MEMBER ++ + # + # LC_PROG_LINUX + # +@@ -4116,6 +4221,12 @@ AC_DEFUN([LC_PROG_LINUX_SRC], [ + LC_SRC_HAVE_LOCKS_LOCK_FILE_WAIT_IN_FILELOCK + LC_SRC_HAVE_U64_CAPABILITY + ++ # 6.4 ++ LC_SRC_HAVE_IOV_ITER_IOVEC ++ LC_SRC_HAVE_IOVEC_WITH_IOV_MEMBER ++ LC_SRC_HAVE_CLASS_CREATE_MODULE_ARG ++ LC_SRC_HAVE_GET_EXPIRY_TIME64_T ++ + # kernel patch to extend integrity interface + LC_SRC_BIO_INTEGRITY_PREP_FN + ]) +@@ -4384,6 +4495,12 @@ AC_DEFUN([LC_PROG_LINUX_RESULTS], [ + LC_HAVE_LOCKS_LOCK_FILE_WAIT_IN_FILELOCK + LC_HAVE_U64_CAPABILITY + ++ # 6.4 ++ LC_HAVE_IOV_ITER_IOVEC ++ LC_HAVE_IOVEC_WITH_IOV_MEMBER ++ LC_HAVE_CLASS_CREATE_MODULE_ARG ++ LC_HAVE_GET_EXPIRY_TIME64_T ++ + # kernel patch to extend integrity interface + LC_BIO_INTEGRITY_PREP_FN + ]) +diff --git a/lustre/include/lustre_compat.h b/lustre/include/lustre_compat.h +index 3040cc22ce..c99c8d3730 100644 +--- a/lustre/include/lustre_compat.h ++++ b/lustre/include/lustre_compat.h +@@ -313,20 +313,22 @@ static inline void iov_iter_truncate(struct iov_iter *i, u64 count) + # define SB_NODIRATIME MS_NODIRATIME + #endif + +-#ifndef HAVE_FILE_OPERATIONS_READ_WRITE_ITER +-static inline void iov_iter_reexpand(struct iov_iter *i, size_t count) +-{ +- i->count = count; +-} +- ++#ifndef HAVE_IOV_ITER_IOVEC + static inline struct iovec iov_iter_iovec(const struct iov_iter *iter) + { + return (struct iovec) { +- .iov_base = iter->iov->iov_base + iter->iov_offset, ++ .iov_base = iter->__iov->iov_base + iter->iov_offset, + .iov_len = min(iter->count, +- iter->iov->iov_len - iter->iov_offset), ++ iter->__iov->iov_len - iter->iov_offset), + }; + } ++#endif ++ ++#ifndef HAVE_FILE_OPERATIONS_READ_WRITE_ITER ++static inline void iov_iter_reexpand(struct iov_iter *i, size_t count) ++{ ++ i->count = count; ++} + + #define iov_for_each(iov, iter, start) \ + for (iter = (start); \ +diff --git a/lustre/mdc/mdc_request.c b/lustre/mdc/mdc_request.c +index 086d13e670..2680d941f5 100644 +--- a/lustre/mdc/mdc_request.c ++++ b/lustre/mdc/mdc_request.c +@@ -3037,7 +3037,7 @@ static int __init mdc_init(void) + if (rc) + return rc; + +- mdc_changelog_class = class_create(THIS_MODULE, MDC_CHANGELOG_DEV_NAME); ++ mdc_changelog_class = ll_class_create(MDC_CHANGELOG_DEV_NAME); + if (IS_ERR(mdc_changelog_class)) { + rc = PTR_ERR(mdc_changelog_class); + goto out_dev; +diff --git a/lustre/ofd/ofd_access_log.c b/lustre/ofd/ofd_access_log.c +index 088ec66a2a..1024c08ad1 100644 +--- a/lustre/ofd/ofd_access_log.c ++++ b/lustre/ofd/ofd_access_log.c +@@ -681,7 +681,7 @@ int ofd_access_log_module_init(void) + + oal_log_major = MAJOR(dev); + +- oal_log_class = class_create(THIS_MODULE, LUSTRE_ACCESS_LOG_DIR_NAME); ++ oal_log_class = ll_class_create(LUSTRE_ACCESS_LOG_DIR_NAME); + if (IS_ERR(oal_log_class)) { + rc = PTR_ERR(oal_log_class); + goto out_dev; +diff --git a/lustre/ptlrpc/gss/gss_svc_upcall.c b/lustre/ptlrpc/gss/gss_svc_upcall.c +index ea94cb663f..b82e6f7cb9 100644 +--- a/lustre/ptlrpc/gss/gss_svc_upcall.c ++++ b/lustre/ptlrpc/gss/gss_svc_upcall.c +@@ -71,6 +71,15 @@ + #include "gss_api.h" + #include "gss_crypto.h" + ++#ifndef HAVE_GET_EXPIRY_2ARGS ++static inline int __get_expiry2(char **bpp, time64_t *rvp) ++{ ++ *rvp = get_expiry(bpp); ++ return *rvp ? 0 : -EINVAL; ++} ++#define get_expiry(ps, pt) __get_expiry2((ps), (pt)) ++#endif ++ + #define GSS_SVC_UPCALL_TIMEOUT (20) + + static DEFINE_SPINLOCK(__ctx_index_lock); +@@ -339,13 +348,13 @@ static int rsi_parse(struct cache_detail *cd, char *mesg, int mlen) + * Directly return -EINVAL in this case. + */ + status = -EINVAL; +- goto out; ++ goto out; + } + + rsii.h.flags = 0; + /* expiry */ +- expiry = get_expiry(&mesg); +- if (expiry == 0) ++ status = get_expiry(&mesg, &expiry); ++ if (status) + goto out; + + len = qword_get(&mesg, buf, mlen); +@@ -582,36 +591,36 @@ static struct cache_head * rsc_alloc(void) + + static int rsc_parse(struct cache_detail *cd, char *mesg, int mlen) + { +- char *buf = mesg; +- int len, rv, tmp_int; +- struct rsc rsci, *rscp = NULL; ++ char *buf = mesg; ++ int len, rv, tmp_int; ++ struct rsc rsci, *rscp = NULL; + time64_t expiry; +- int status = -EINVAL; +- struct gss_api_mech *gm = NULL; ++ int status = -EINVAL; ++ struct gss_api_mech *gm = NULL; + +- memset(&rsci, 0, sizeof(rsci)); ++ memset(&rsci, 0, sizeof(rsci)); + +- /* context handle */ +- len = qword_get(&mesg, buf, mlen); +- if (len < 0) goto out; +- status = -ENOMEM; +- if (rawobj_alloc(&rsci.handle, buf, len)) +- goto out; +- +- rsci.h.flags = 0; +- /* expiry */ +- expiry = get_expiry(&mesg); +- status = -EINVAL; +- if (expiry == 0) +- goto out; +- +- /* remote flag */ +- rv = get_int(&mesg, &tmp_int); +- if (rv) { +- CERROR("fail to get remote flag\n"); +- goto out; +- } +- rsci.ctx.gsc_remote = (tmp_int != 0); ++ /* context handle */ ++ len = qword_get(&mesg, buf, mlen); ++ if (len < 0) goto out; ++ status = -ENOMEM; ++ if (rawobj_alloc(&rsci.handle, buf, len)) ++ goto out; ++ ++ rsci.h.flags = 0; ++ /* expiry */ ++ status = get_expiry(&mesg, &expiry); ++ if (status) ++ goto out; ++ ++ status = -EINVAL; ++ /* remote flag */ ++ rv = get_int(&mesg, &tmp_int); ++ if (rv) { ++ CERROR("fail to get remote flag\n"); ++ goto out; ++ } ++ rsci.ctx.gsc_remote = (tmp_int != 0); + + /* root user flag */ + rv = get_int(&mesg, &tmp_int); +@@ -621,41 +630,41 @@ static int rsc_parse(struct cache_detail *cd, char *mesg, int mlen) + } + rsci.ctx.gsc_usr_root = (tmp_int != 0); + +- /* mds user flag */ +- rv = get_int(&mesg, &tmp_int); +- if (rv) { +- CERROR("fail to get mds user flag\n"); +- goto out; +- } +- rsci.ctx.gsc_usr_mds = (tmp_int != 0); ++ /* mds user flag */ ++ rv = get_int(&mesg, &tmp_int); ++ if (rv) { ++ CERROR("fail to get mds user flag\n"); ++ goto out; ++ } ++ rsci.ctx.gsc_usr_mds = (tmp_int != 0); + +- /* oss user flag */ +- rv = get_int(&mesg, &tmp_int); +- if (rv) { +- CERROR("fail to get oss user flag\n"); +- goto out; +- } +- rsci.ctx.gsc_usr_oss = (tmp_int != 0); ++ /* oss user flag */ ++ rv = get_int(&mesg, &tmp_int); ++ if (rv) { ++ CERROR("fail to get oss user flag\n"); ++ goto out; ++ } ++ rsci.ctx.gsc_usr_oss = (tmp_int != 0); + +- /* mapped uid */ +- rv = get_int(&mesg, (int *) &rsci.ctx.gsc_mapped_uid); +- if (rv) { +- CERROR("fail to get mapped uid\n"); +- goto out; +- } ++ /* mapped uid */ ++ rv = get_int(&mesg, (int *) &rsci.ctx.gsc_mapped_uid); ++ if (rv) { ++ CERROR("fail to get mapped uid\n"); ++ goto out; ++ } + +- rscp = rsc_lookup(&rsci); +- if (!rscp) +- goto out; +- +- /* uid, or NEGATIVE */ +- rv = get_int(&mesg, (int *) &rsci.ctx.gsc_uid); +- if (rv == -EINVAL) +- goto out; +- if (rv == -ENOENT) { +- CERROR("NOENT? set rsc entry negative\n"); ++ rscp = rsc_lookup(&rsci); ++ if (!rscp) ++ goto out; ++ ++ /* uid, or NEGATIVE */ ++ rv = get_int(&mesg, (int *) &rsci.ctx.gsc_uid); ++ if (rv == -EINVAL) ++ goto out; ++ if (rv == -ENOENT) { ++ CERROR("NOENT? set rsc entry negative\n"); + set_bit(CACHE_NEGATIVE, &rsci.h.flags); +- } else { ++ } else { + rawobj_t tmp_buf; + time64_t ctx_expiry; + +@@ -699,23 +708,23 @@ static int rsc_parse(struct cache_detail *cd, char *mesg, int mlen) + * We want just the number of seconds into the future. + */ + expiry += ctx_expiry - ktime_get_real_seconds(); +- } ++ } + +- rsci.h.expiry_time = expiry; +- rscp = rsc_update(&rsci, rscp); +- status = 0; ++ rsci.h.expiry_time = expiry; ++ rscp = rsc_update(&rsci, rscp); ++ status = 0; + out: +- if (gm) +- lgss_mech_put(gm); +- rsc_free(&rsci); +- if (rscp) +- cache_put(&rscp->h, &rsc_cache); +- else +- status = -ENOMEM; ++ if (gm) ++ lgss_mech_put(gm); ++ rsc_free(&rsci); ++ if (rscp) ++ cache_put(&rscp->h, &rsc_cache); ++ else ++ status = -ENOMEM; + +- if (status) +- CERROR("parse rsc error %d\n", status); +- return status; ++ if (status) ++ CERROR("parse rsc error %d\n", status); ++ return status; + } + + static struct cache_detail rsc_cache = { +-- +2.33.0 + diff --git a/find-provides b/find-provides new file mode 100755 index 0000000000000000000000000000000000000000..e0738e0321d03a29cd4643bff9d2c0c22065eea6 --- /dev/null +++ b/find-provides @@ -0,0 +1,62 @@ +#!/bin/bash + +# This script reads filenames from STDIN and outputs any relevant provides +# information that needs to be included in the package. + +if [ "$1" ] +then + package_name="$1" +fi + +filelist=`sed "s/['\"]/\\\&/g"` + +[ -x /usr/lib/rpm/rpmdeps -a -n "$filelist" ] && + echo $filelist | tr '[:blank:]' \\n | /usr/lib/rpm/rpmdeps --provides + +# +# --- any other extra find-provides scripts +for i in /usr/lib/rpm/redhat/find-provides.d/*.prov +do + [ -x $i ] && + (echo $filelist | tr '[:blank:]' \\n | $i | sort -u) +done + +# +# --- Kernel module imported symbols +# +# Since we don't (yet) get passed the name of the package being built, we +# cheat a little here by looking first for a kernel, then for a kmod. +# + +is_kmod=1 +for f in $filelist; do + if [ $(echo "$f" | sed -r -ne 's:^.*/lib/modules/(.*)/(.*)\.ko(\.gz|\.bz2|\.xz)?$:\2:p') ] + then + is_kernel=1; + fi + if [ $(echo "$f" | sed -r -ne 's:^.*/boot/(.*):\1:p') ] + then + unset is_kmod; + fi +done +if [ ! "$is_kernel" ] || [ "$package_name" == "kernel" ] +then + unset is_kmod +fi + +FIND_PROVIDES_KSYMS=/usr/lib/rpm/redhat/find-provides.ksyms +MODULE_SYMVERS=$RPM_BUILD_ROOT/Module.symvers +if [[ -f $MODULE_SYMVERS ]] ; then + _sourcedir=$(realpath $(dirname "$0")) + FIND_PROVIDES_KSYMS=$_sourcedir/find-provides.ksyms +else + >&2 echo "*****************************************************************" + >&2 echo "$MODULE_SYMVERS not found." + >&2 echo "Falling back to redhad find-provides.ksyms" + >&2 echo "*****************************************************************" +fi + +[ -x $FIND_PROVIDES_KSYMS ] && [ "$is_kmod" ] && + printf "%s\n" "${filelist[@]}" | $FIND_PROVIDES_KSYMS + +exit 0 diff --git a/find-provides.ksyms b/find-provides.ksyms new file mode 100755 index 0000000000000000000000000000000000000000..7f4c863f383f8acc2f51af6e772c4cea332e79c1 --- /dev/null +++ b/find-provides.ksyms @@ -0,0 +1,44 @@ +#! /bin/bash + +IFS=$'\n' + +MODULE_SYMVERS=$RPM_BUILD_ROOT/Module.symvers + +for module in $(grep -E '/lib/modules/.+\.ko(\.gz|\.bz2|\.xz)?$'); do + tmpfile="" + if [ "x${module%.ko}" = "x${module}" ]; then + tmpfile=$(mktemp -t ${0##*/}.XXXXXX.ko) + proc_bin= + case "${module##*.}" in + xz) + proc_bin=xz + ;; + bz2) + proc_bin=bzip2 + ;; + gz) + proc_bin=gzip + ;; + esac + + [ -n "$proc_bin" ] || continue + + "$proc_bin" -d -c - < "$module" > "$tmpfile" || continue + module="$tmpfile" + fi + + if [[ -f $MODULE_SYMVERS ]] ; then + # all symbols prefixed with __rcr_ where the symbol is: + # A - symbol is an absolute value + # D,d - symbol is in the initialized data section + # R,r - symbol is in the read-only data section + # T,t - symbol is in the text (code) section + for sym in $(nm $module | sed -r -ne 's:^0*([0-9a-f]+) [ADdRr] __crc_(.+):\2:p'); do + grep -w $sym $MODULE_SYMVERS | awk '{printf("ksym(%s) = %08s\n", $2, $1)}' + done \ + | LC_ALL=C sort -u + else + >&2 echo "Module.symvers required for provides." + fi + [ -z "$tmpfile" ] || rm -f -- "$tmpfile" +done diff --git a/kmp-lustre-osd-ldiskfs.files b/kmp-lustre-osd-ldiskfs.files index 47bcee182499932c4c7641f957c4088fea795651..ffd12c1ebe6f8ecab3c2e0d20c87fc27ec0d6080 100644 --- a/kmp-lustre-osd-ldiskfs.files +++ b/kmp-lustre-osd-ldiskfs.files @@ -1,3 +1,5 @@ %defattr(-,root,root) +%dir %{modules_fs_path}/%{lustre_name}-osd-ldiskfs +%dir %{modules_fs_path}/%{lustre_name}-osd-ldiskfs/fs %{modules_fs_path}/%{lustre_name}-osd-ldiskfs/fs/ldiskfs.ko %{modules_fs_path}/%{lustre_name}-osd-ldiskfs/fs/osd_ldiskfs.ko diff --git a/kmp-lustre-osd-ldiskfs.preamble b/kmp-lustre-osd-ldiskfs.preamble index cdd8a122e85ba6af1adbe00dac7b397e77686eed..135ea611020828300aec18dc575be0ac719ec842 100644 --- a/kmp-lustre-osd-ldiskfs.preamble +++ b/kmp-lustre-osd-ldiskfs.preamble @@ -1,4 +1,7 @@ License: GPL-2.0-only +%if 0%{?suse_version} > 1 +Requires: kernel-%1 +%endif Requires: %{requires_kmod_name} = %{requires_kmod_version} Requires: ldiskfsprogs >= 1.44.3.wc1 Requires: %{name}-osd-ldiskfs-mount = %{version} diff --git a/kmp-lustre-osd-zfs.files b/kmp-lustre-osd-zfs.files index 0ac2677dd8fb8a3533b03c258b7a104ee738e6bf..737eeeebf84dca3f853e620bca0eb38e6fbad3c1 100644 --- a/kmp-lustre-osd-zfs.files +++ b/kmp-lustre-osd-zfs.files @@ -1,2 +1,4 @@ %defattr(-,root,root) +%dir %{modules_fs_path}/%{lustre_name}-osd-zfs +%dir %{modules_fs_path}/%{lustre_name}-osd-zfs/fs %{modules_fs_path}/%{lustre_name}-osd-zfs/fs/osd_zfs.ko diff --git a/kmp-lustre-osd-zfs.preamble b/kmp-lustre-osd-zfs.preamble index 339ed9bbe0514a467a30c4396347c588a93746c1..b6581b9e4500152698f1905cc32c69754b3b8fac 100644 --- a/kmp-lustre-osd-zfs.preamble +++ b/kmp-lustre-osd-zfs.preamble @@ -1,5 +1,8 @@ Summary: Lustre osd-zfs feature support License: GPL-2.0-only +%if 0%{?suse_version} > 1 +Requires: kernel-%1 +%endif Requires: %{name}-osd-zfs-mount = %{version} Provides: %{name}-osd = %{version} Obsoletes: %{name}-osd-zfs < %{version} diff --git a/kmp-lustre-tests.files b/kmp-lustre-tests.files index f62b46f963be3f4721e163731ed8f840ee63a36f..fd7aed8a68e362295e0f2b07749a6708d3140507 100644 --- a/kmp-lustre-tests.files +++ b/kmp-lustre-tests.files @@ -1 +1,3 @@ +%dir %{modules_fs_path}/%{lustre_name}-tests +%dir %{modules_fs_path}/%{lustre_name}-tests/fs %{modules_fs_path}/%{lustre_name}-tests/fs/llog_test.ko diff --git a/kmp-lustre-tests.preamble b/kmp-lustre-tests.preamble new file mode 100644 index 0000000000000000000000000000000000000000..f2b74206eaced070133e97f46f43d9eb07f58bf3 --- /dev/null +++ b/kmp-lustre-tests.preamble @@ -0,0 +1,7 @@ +License: GPL-2.0-only +%if 0%{?suse_version} > 1 +Requires: kernel-%1 +%endif +%if %{with lustre_modules} +Requires: %{requires_kmod_name} = %{requires_kmod_version} +%endif diff --git a/kmp-lustre.files b/kmp-lustre.files index 62e39d0d0fba71dd9023fc77084d21bd429c49b9..3ded0c4bb03f0a0a29e5ea4c48e1752915ef7c0c 100644 --- a/kmp-lustre.files +++ b/kmp-lustre.files @@ -1,4 +1,6 @@ %defattr(-,root,root) +%dir %{modules_fs_path} +%dir %{modules_fs_path}/%{lustre_name} %{modules_fs_path}/%{lustre_name}/* %doc COPYING %doc ChangeLog-lustre diff --git a/kmp-lustre.preamble b/kmp-lustre.preamble index 9224573471ae63e94ad8c018921b52e947b9fcdd..edb68f0d023348e150011c6e1f95bd10e51f7040 100644 --- a/kmp-lustre.preamble +++ b/kmp-lustre.preamble @@ -1,2 +1,5 @@ +%if 0%{?suse_version} > 1 +Requires: kernel-%1 +%endif Obsoletes: %{name}-modules < %{version} License: GPL-2.0-only diff --git a/lustre.spec b/lustre.spec index 5b896ef0518d84222ba4e85985c82ac3ceb2a86f..b066313bc524f187b7f4e0c20ccd6597c8f0747e 100644 --- a/lustre.spec +++ b/lustre.spec @@ -1,4 +1,12 @@ -# lustre.spec +# SPDX-License-Identifier: GPL-2.0 + +# +# This file is part of Lustre, http://www.lustre.org/ +# +# lustre.spec.in +# +# spec file template for RHEL package builds +# # Declare rpmbuild --with/--without parameters %bcond_with servers @@ -49,7 +57,7 @@ %undefine with_lustre_tests %endif -%{!?version: %global version 2.15.54} +%{!?version: %global version 2.15.57} # if you want a custom kernel version set it variable with $ver.$arch %{!?kver: %global kver %(rpm -q --qf '%%{VERSION}-%%{RELEASE}.%%{ARCH}' `rpm -q kernel-devel | sort -rV|head -n 1`)} # cut epoch for kmodtool @@ -104,25 +112,31 @@ # response from them #%%global _use_internal_dependency_generator 0 +%if 0%{?rhel} > 7 || 0%{?fedora} > 33 +## SUSE uses another tool for provides: +## https://github.com/openSUSE/kernel-source/blob/master/patches.rpmify/Add-ksym-provides-tool.patch +%global __find_provides %{_sourcedir}/find-provides +%endif + # Set the package name prefix %if %{undefined lustre_name} %if %{with servers} - %global lustre_name lustre + %global lustre_name lustre %else - %global lustre_name lustre-client + %global lustre_name lustre-client %endif %endif %if %{with lustre_modules} %if %{undefined kmoddir} %if %{defined kernel_module_package_moddir} - %global kmoddir %{kernel_module_package_moddir} + %global kmoddir %{kernel_module_package_moddir} %else - %if %{defined suse_kernel_module_package} - %global kmoddir updates - %else - %global kmoddir extra - %endif + %if %{defined suse_kernel_module_package} + %global kmoddir updates + %else + %global kmoddir extra + %endif %endif %endif @@ -178,10 +192,13 @@ Summary: Lustre File System Name: %{lustre_name} -Version: 2.15.54 -Release: 3 +Version: 2.15.57 +Release: 1 License: GPL-2.0-only AND LGPL-2.1-or-later -Group: System Environment/Kernel +%if 0%{?suse_version} >= 1310 +# SUSE needs Group for the kernel_module_package macro +Group: System/Kernel +%endif Source: https://github.com/lustre/lustre-release/archive/refs/tags/%{version}.tar.gz Source1: kmp-lustre.preamble Source2: kmp-lustre.files @@ -189,16 +206,15 @@ Source3: kmp-lustre-osd-ldiskfs.preamble Source4: kmp-lustre-osd-ldiskfs.files Source5: kmp-lustre-osd-zfs.preamble Source6: kmp-lustre-osd-zfs.files -Source7: kmp-lustre-tests.files +Source7: kmp-lustre-tests.preamble +Source8: kmp-lustre-tests.files +Source9: find-provides +Source10: find-provides.ksyms URL: https://wiki.whamcloud.com/ BuildRoot: %{_tmppath}/lustre-%{version}-root # patches -Patch1: 0001-LU-16327-llite-read_folio-release_folio-filler_t.patch -Patch2: 0002-LU-16328-llite-Linux-6.0-migrate_folio-vfs_setxattr.patch -Patch3: 0003-LU-16351-llite-Linux-6.1-prandom-folios_contig-vma_i.patch -Patch4: 0004-LU-16662-autoconf-fix-configure-test-compile-for-CON.patch -Patch5: 0005-lustre.spec.in-Add-gcc-option-Wno-stringop-overflow.patch +Patch1: LU-16802-build-iov_iter_iovec-class_create-get_expir.patch %if %{with lustre_modules} Requires: %{requires_kmod_name} = %{requires_kmod_version} @@ -207,19 +223,37 @@ Requires: %{requires_kmod_name} = %{requires_kmod_version} Requires: python3 >= 3.6.0 BuildRequires: python3-devel >= 3.6.0, swig %endif -BuildRequires: libtool libyaml-devel zlib-devel libnl3-devel flex bison +BuildRequires: libtool pkgconfig(yaml-0.1) pkgconfig(zlib) pkgconfig(libnl-3.0) flex bison %if "%{_vendor}" == "redhat" BuildRequires: redhat-rpm-config BuildRequires: pkgconfig +%if 0%{?rhel} > 7 || 0%{?fedora} > 33 || 0%{?rhel} < 1 +Suggests: bash-completion +%endif %else %if "%{_vendor}" == "openEuler" BuildRequires: openEuler-rpm-config +%if %{with ldiskfs} +BuildRequires: kernel-debugsource +%endif %endif BuildRequires: pkg-config %endif %if %{with gss} BuildRequires: krb5-devel openssl-devel %endif +%if %{with lustre_modules} +# abuild (auto-build) used by SUSE Open Build Service +# need kernel-source as a build requirement, but the code +# which extracts these requirements don't understand %() +# and treats all such as failures. So the following dance +# Allows the requirements to be seen by abuild, but ignored +# by lbuild. +%if "%(echo $USER)" != "abuild" +%else +BuildRequires: kernel-source +%endif +%endif %if %{with servers} Requires: %{name}-osd Requires: %{name}-osd-mount @@ -230,7 +264,7 @@ Obsoletes: lustre-client < %{version} Provides: lustre-client = %{version}-%{release} %if "%{_vendor}" == "redhat" || "%{_vendor}" == "fedora" || "%{_vendor}" == "openEuler" #suse don't support selinux -BuildRequires: libselinux-devel +BuildRequires: pkgconfig(libselinux) %endif %if %{with lustre_modules} %if %{with mofed} @@ -249,7 +283,7 @@ BuildRequires: rpm-build >= 4.14.3 %endif BuildRequires: %kernel_module_package_buildreqs # need to provide a /usr/lib/${uname -r)/build dir -BuildRequires: kernel +BuildRequires: kernel >= 3.10 %if "%{_vendor}" == "redhat" %if %{with kabi} BuildRequires: kernel-abi-whitelists @@ -261,10 +295,10 @@ BuildRequires: kernel-abi-whitelists Requires(post): systemd Requires(preun): systemd Requires(postun): systemd -BuildRequires: systemd +BuildRequires: pkgconfig(systemd) %endif -BuildRequires: libmount-devel +BuildRequires: pkgconfig(mount) %description Userspace tools and files for the Lustre file system. @@ -296,17 +330,17 @@ echo $TMPFILE %kernel_module_package -n %{name}-osd-ldiskfs -p %SOURCE3 -f %SOURCE4 %{_flavor} %if %{with lustre_utils} %package osd-ldiskfs-mount -Summary: osd-ldiskfs-mount contains mount's ldiskfs specific dso. +Summary: Lustre mount's ldiskfs-specific helper library BuildRequires: e2fsprogs-devel >= 1.44.3 -Requires: ldiskfsprogs > 1.45.6 libmount +Requires: ldiskfsprogs > 1.45.6 Provides: lustre-osd-mount = %{version} Provides: %{name}-osd-mount = %{version} Obsoletes: %{name}-osd-mount < %{version} Obsoletes: lustre-osd-mount < %{version} -Group: System Environment/Kernel %description osd-ldiskfs-mount -LDISKFS hooks for mount/mkfs into a dynamic library. +Provide a shared library (dso) that can be loaded into various +lustre tools (mount/mkfs) to provide support for ldisfs # with lustre_utils %endif @@ -317,17 +351,16 @@ LDISKFS hooks for mount/mkfs into a dynamic library. %kernel_module_package -n %{name}-osd-zfs -p %SOURCE5 -f %SOURCE6 %{_flavor} %if %{with lustre_utils} %package osd-zfs-mount -Summary: osd-zfs-mount contains mount's zfs specific dso. -Requires: libmount +Summary: Lustre mount's zfs-specific helper library Provides: %{name}-osd-mount = %{version} Obsoletes: lustre-osd-mount < %{version} # Tests also require zpool from zfs package: Requires: zfs Requires: %{requires_kmod_osd_zfs_name} -Group: System Environment/Kernel %description osd-zfs-mount -ZFS hooks for mount/mkfs into a dynamic library. +Provide a shared library (dso) that can be loaded into various +lustre tools (mount/mkfs) to provide support for ZFS. # with lustre_utils %endif @@ -339,7 +372,6 @@ ZFS hooks for mount/mkfs into a dynamic library. %if %{with servers} %package resource-agents Summary: HA Resuable Cluster Resource Scripts for Lustre -Group: System Environment/Base Requires: %{name} Requires: resource-agents @@ -350,7 +382,6 @@ environment for both Pacemaker and rgmanager. %package devel Summary: Lustre include headers -Group: Development/Kernel Provides: lustre-devel = %{version} Requires: %{lustre_name} = %{version} %if %{with lustre_modules} @@ -366,7 +397,6 @@ applications against the Lustre / LNet utilities libraries. %if %{with lustre_tests} %package tests Summary: Lustre testing framework -Group: System Environment/Kernel Provides: %{name}-tests = %{version} %if %{with lustre_iokit} Requires: %{name} = %{version}, lustre-iokit @@ -384,7 +414,14 @@ Requires: %{requires_kmod_tests_name} = %{requires_kmod_version} %if %{with lustre_tests_lutf} Requires: python3 >= 3.6.0 %endif -Requires: attr, rsync, perl, lsof, /usr/bin/getconf +Requires: attr, rsync, lsof, /usr/bin/getconf +Requires: /usr/sbin/getenforce, acl, /usr/bin/killall, /usr/bin/ping, bc +# Of the supported targets, only rhel7 doesn't support Recommends. +%if 0%{?rhel} > 7 || 0%{?fedora} > 33 || 0%{?rhel} < 1 +Recommends: perl, dbench, iozone +# Either of these is sufficient +Suggests: pdsh, clush +%endif %if %{with mpi} %if "%{mpi_name}" == "mpich" BuildRequires: mpich-devel @@ -405,15 +442,14 @@ This package contains a set of test binaries and scripts that are intended to be used by the Lustre testing framework. %if %{with lustre_modules} -%kernel_module_package -n %{name}-tests -f %SOURCE7 %{_flavor} +%kernel_module_package -n %{name}-tests -p %SOURCE7 -f %SOURCE8 %{_flavor} %endif %endif %if %{with lustre_iokit} %package -n lustre-iokit -Summary: The Lustre IO-Kit is a collection of benchmark tools for a cluster with the Lustre file system. -Group: Applications/System -Requires: python3, sg3_utils +Summary: Collection of benchmark tools for a cluster with the Lustre file system +Requires: perl, sg3_utils %description -n lustre-iokit This package includes five tools: @@ -436,13 +472,16 @@ This script will collect IO stats on a defined set of nodes. ior-survey: A script to run the IOR benchmark. The latest version can be downloaded from -http://www.llnl.gov/asci/purple/benchmarks/limited/ior/ +https://github.com/hpc/ior/ mds-survey: This survey tests the local metadata performance using the echo_client to drive the MDD layer to perform operations. It is run with multiple threads (to simulate MDT service threads) locally on the MDS node, and does not need Lustre clients in order to run + +lst-survey: +This survey tests LNet performance between a group of clients and servers. %endif %if 0%{?suse_version} @@ -478,7 +517,7 @@ export UTILS_CFLAGS="${UTILS_CFLAGS} -D__SANE_USERSPACE_TYPES__=1" # Disable any hardening or annotation since this doesn't make sense for # kernel code, and reset "optflags" so that the vendor's overzealous flags don't # create build failures. -%define optflags -g -O2 -Werror -Wno-stringop-overflow +%define optflags -g -O2 -Werror -Wno-stringop-overflow -Wno-format-truncation -Wno-use-after-free %undefine _annotated_build %undefine _hardened_build @@ -600,6 +639,7 @@ make install DESTDIR=$RPM_BUILD_ROOT # Lustre's build system. This is not expected to bother SLES's # kernel_module_path macro. basemodpath=$RPM_BUILD_ROOT%{modules_fs_path}/%{name} +%{__install} -D -m 0644 ${PWD}/Module.symvers %{buildroot}/Module.symvers %if %{with ldiskfs} mkdir -p $basemodpath-osd-ldiskfs/fs mv $basemodpath/fs/osd_ldiskfs.ko $basemodpath-osd-ldiskfs/fs/osd_ldiskfs.ko @@ -633,6 +673,8 @@ fi # legacy syntax. Install a compatibility symlink to avoid conflicts when # newer-style agents are added. ln -s Lustre.ha_v2 $RPM_BUILD_ROOT%{_sysconfdir}/ha.d/resource.d/Lustre +echo '%dir %{_sysconfdir}/ha.d' >>lustre.files +echo '%dir %{_sysconfdir}/ha.d/resource.d' >>lustre.files echo '%{_sysconfdir}/ha.d/resource.d/Lustre.ha_v2' >>lustre.files echo '%{_sysconfdir}/ha.d/resource.d/Lustre' >>lustre.files %endif @@ -689,6 +731,7 @@ if [ -d $RPM_BUILD_ROOT%{_libdir}/lustre ] ; then fi %endif +echo '%{_prefix}/lib/firewalld/services/*.xml' >>lustre.files %if %{with lustre_modules} # mark modules executable for find-debuginfo.sh find $RPM_BUILD_ROOT/lib/modules -name \*.ko -type f -exec chmod u+x {} \; @@ -707,6 +750,8 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/liblustreapi.la %endif # mpi %endif +echo '%dir %{_libdir}/lustre' >>lustre-tests.files +echo '%dir %{_libdir}/lustre/tests' >>lustre-tests.files echo '%{_libdir}/lustre/tests/*' >>lustre-tests.files echo '%{_bindir}/mcreate' >>lustre-tests.files echo '%{_bindir}/munlink' >>lustre-tests.files @@ -755,6 +800,7 @@ echo '%{_libdir}/lustre/tests/lutf/*' >>lustre-tests.files %endif %if %{with lustre_utils} %if %{with servers} +%dir %{_libexecdir}/lustre %{_libexecdir}/lustre/lc_common %{_libexecdir}/lustre/haconfig %{_bindir}/lustre_req_history @@ -784,9 +830,9 @@ echo '%{_libdir}/lustre/tests/lutf/*' >>lustre-tests.files %if %{with shared} %{_libdir}/liblustreapi.so.* %endif -%{_sysconfdir}/udev/rules.d/99-lustre.rules +%{_udevrulesdir}/99-lustre.rules %if %{with servers} -%{_sysconfdir}/udev/rules.d/99-lustre-server.rules +%{_udevrulesdir}/99-lustre-server.rules %endif %if %{with zfs} %config(noreplace) %{_sysconfdir}/ldev.conf @@ -797,11 +843,13 @@ echo '%{_libdir}/lustre/tests/lutf/*' >>lustre-tests.files %config(noreplace) %{_sysconfdir}/lnet_routes.conf %endif %if %{with lustre_modules} +%exclude /Module.symvers %if %{with shared} %if %{with ldiskfs} %if %{with lustre_utils} %files osd-ldiskfs-mount %defattr(-,root,root) +%dir %{_libdir}/lustre %{_libdir}/lustre/mount_osd_ldiskfs.so %endif %endif @@ -812,6 +860,7 @@ echo '%{_libdir}/lustre/tests/lutf/*' >>lustre-tests.files %if %{with lustre_utils} %files osd-zfs-mount %defattr(-,root,root) +%dir %{_libdir}/lustre %{_libdir}/lustre/mount_osd_zfs.so %{_sysconfdir}/zfs/zed.d/* %endif @@ -824,6 +873,8 @@ echo '%{_libdir}/lustre/tests/lutf/*' >>lustre-tests.files %if %{with servers} %files resource-agents %defattr(0755,root,root) +%dir %{_prefix}/lib/ocf +%dir %{_prefix}/lib/ocf/resource.d %{_prefix}/lib/ocf/resource.d/lustre/ %endif @@ -849,12 +900,15 @@ echo '%{_libdir}/lustre/tests/lutf/*' >>lustre-tests.files %{_bindir}/obdfilter-survey %{_bindir}/ost-survey %{_bindir}/sgpdd-survey +%{_bindir}/lst-survey +%{_bindir}/lst.sh %doc lustre-iokit/ior-survey/README.ior-survey %doc lustre-iokit/mds-survey/README.mds-survey %doc lustre-iokit/obdfilter-survey/README.obdfilter-survey %doc lustre-iokit/ost-survey/README.ost-survey %doc lustre-iokit/sgpdd-survey/README.sgpdd-survey %doc lustre-iokit/stats-collect/README.iokit-lstats +%doc lustre-iokit/lst-survey/README.lst-survey %endif %post @@ -877,6 +931,9 @@ rm -rf $RPM_BUILD_ROOT rm -rf %{_tmppath}/kmp %changelog +* Thu Aug 03 2023 Xinliang Liu - 2.15.57-1 +- Update to 2.15.57 with kernel 6.4 support patch. + * Fri May 12 2023 Xinliang Liu - 2.15.54-3 - Fix client build requires libmount-devel