View Issue Details

IDProjectCategoryView StatusLast Update
0001400channel: elrepo/el9kmod-hfspluspublic2023-11-12 11:59
Reportertoracat Assigned Topperry  
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
Summary0001400: Build kmod-hfsplus for EL 9.3
DescriptionAn attempt to build kmod-hfsplus using the source code from the 9.3 GA kernel fails with errors.
Additional InformationRelated to a similar request for EL 9.2 ( https://elrepo.org/bugs/view.php?id=1360 ).
TagsNo tags attached.

Activities

pperry

2023-11-11 10:30

administrator   ~0009417

/home/phil/rpmbuild/BUILD/hfsplus-0.7/inode.c: In function 'hfsplus_releasepage':
/home/phil/rpmbuild/BUILD/hfsplus-0.7/inode.c:124:42: error: passing argument 1 of 'try_to_free_buffers' from incompatible pointer type [-Werror=incompatible-pointer-types]
  124 | return res ? try_to_free_buffers(page) : 0;
      | ^~~~
      | |
      | struct page *
In file included from /home/phil/rpmbuild/BUILD/hfsplus-0.7/hfsplus_fs.h:22,
                 from /home/phil/rpmbuild/BUILD/hfsplus-0.7/inode.c:22:
./include/linux/buffer_head.h:185:26: note: expected 'struct folio *' but argument is of type 'struct page *'
  185 | bool try_to_free_buffers(struct folio *);
      | ^~~~~~~~~~~~~~
/home/phil/rpmbuild/BUILD/hfsplus-0.7/inode.c: At top level:
/home/phil/rpmbuild/BUILD/hfsplus-0.7/inode.c:166:10: error: 'const struct address_space_operations' has no member named 'releasepage'
  166 | .releasepage = hfsplus_releasepage,
      | ^~~~~~~~~~~
/home/phil/rpmbuild/BUILD/hfsplus-0.7/inode.c:166:27: error: initialization of 'void (*)(struct folio *, size_t, size_t)' {aka 'void (*)(struct folio *, long unsigned int, long unsigned int)'} from incompatible pointer type 'int (*)(struct page *, gfp_t)' {aka 'int (*)(struct page *, unsigned int)'} [-Werror=incompatible-pointer-types]
  166 | .releasepage = hfsplus_releasepage,
      | ^~~~~~~~~~~~~~~~~~~
/home/phil/rpmbuild/BUILD/hfsplus-0.7/inode.c:166:27: note: (near initialization for 'hfsplus_btree_aops.invalidate_folio')
cc1: some warnings being treated as errors
make[1]: *** [scripts/Makefile.build:299: /home/phil/rpmbuild/BUILD/hfsplus-0.7/inode.o] Error 1
make[1]: *** Waiting for unfinished jobs....
/home/phil/rpmbuild/BUILD/hfsplus-0.7/extents.c: In function 'hfsplus_file_truncate':
/home/phil/rpmbuild/BUILD/hfsplus-0.7/extents.c:560:23: error: implicit declaration of function 'pagecache_write_begin' [-Werror=implicit-function-declaration]
  560 | res = pagecache_write_begin(NULL, mapping, size, 0, 0,
      | ^~~~~~~~~~~~~~~~~~~~~


/home/phil/rpmbuild/BUILD/hfsplus-0.7/extents.c:564:23: error: implicit declaration of function 'pagecache_write_end'; did you mean 'generic_write_end'? [-Werror=implicit-function-declaration]
  564 | res = pagecache_write_end(NULL, mapping, size,
      | ^~~~~~~~~~~~~~~~~~~
      | generic_write_end

pperry

2023-11-11 14:03

administrator   ~0009418

Packages built and released to the testing repo:

kmod-hfsplus-0.7-1.el9_3.elrepo.src.rpm
kmod-hfsplus-0.7-1.el9_3.elrepo.x86_64.rpm

toracat

2023-11-11 14:05

administrator   ~0009420

Tell us how you fixed it, please.

pperry

2023-11-12 11:59

administrator   ~0009421

Patches atteched
elrepo-hfsplus-convert_to_release_folio.el9_3.patch (2,335 bytes)   
diff -Naurp hfsplus-0.7.orig/inode.c hfsplus-0.7/inode.c
--- hfsplus-0.7.orig/inode.c	2023-10-03 13:09:50.000000000 +0100
+++ hfsplus-0.7/inode.c	2023-11-11 17:07:50.471274961 +0000
@@ -64,14 +64,15 @@ static sector_t hfsplus_bmap(struct addr
 	return generic_block_bmap(mapping, block, hfsplus_get_block);
 }
 
-static int hfsplus_releasepage(struct page *page, gfp_t mask)
+static bool hfsplus_release_folio(struct folio *folio, gfp_t mask)
 {
-	struct inode *inode = page->mapping->host;
+	struct inode *inode = folio->mapping->host;
 	struct super_block *sb = inode->i_sb;
 	struct hfs_btree *tree;
 	struct hfs_bnode *node;
 	u32 nidx;
-	int i, res = 1;
+	int i;
+	bool res = true;
 
 	switch (inode->i_ino) {
 	case HFSPLUS_EXT_CNID:
@@ -85,26 +86,26 @@ static int hfsplus_releasepage(struct pa
 		break;
 	default:
 		BUG();
-		return 0;
+		return false;
 	}
 	if (!tree)
-		return 0;
+		return false;
 	if (tree->node_size >= PAGE_SIZE) {
-		nidx = page->index >>
+		nidx = folio->index >>
 			(tree->node_size_shift - PAGE_SHIFT);
 		spin_lock(&tree->hash_lock);
 		node = hfs_bnode_findhash(tree, nidx);
 		if (!node)
 			;
 		else if (atomic_read(&node->refcnt))
-			res = 0;
+			res = false;
 		if (res && node) {
 			hfs_bnode_unhash(node);
 			hfs_bnode_free(node);
 		}
 		spin_unlock(&tree->hash_lock);
 	} else {
-		nidx = page->index <<
+		nidx = folio->index <<
 			(PAGE_SHIFT - tree->node_size_shift);
 		i = 1 << (PAGE_SHIFT - tree->node_size_shift);
 		spin_lock(&tree->hash_lock);
@@ -113,7 +114,7 @@ static int hfsplus_releasepage(struct pa
 			if (!node)
 				continue;
 			if (atomic_read(&node->refcnt)) {
-				res = 0;
+				res = false;
 				break;
 			}
 			hfs_bnode_unhash(node);
@@ -121,7 +122,7 @@ static int hfsplus_releasepage(struct pa
 		} while (--i && nidx < tree->node_count);
 		spin_unlock(&tree->hash_lock);
 	}
-	return res ? try_to_free_buffers(page) : 0;
+	return res ? try_to_free_buffers(folio) : false;
 }
 
 static ssize_t hfsplus_direct_IO(struct kiocb *iocb, struct iov_iter *iter)
@@ -163,7 +164,7 @@ const struct address_space_operations hf
 	.write_begin	= hfsplus_write_begin,
 	.write_end	= generic_write_end,
 	.bmap		= hfsplus_bmap,
-	.releasepage	= hfsplus_releasepage,
+	.release_folio	= hfsplus_release_folio,
 };
 
 const struct address_space_operations hfsplus_aops = {
elrepo-hfsplus-pagecache_write_begin_end.el9_3.patch (1,997 bytes)   
diff -Naurp hfsplus-0.7.orig/extents.c hfsplus-0.7/extents.c
--- hfsplus-0.7.orig/extents.c	2023-10-03 13:09:50.000000000 +0100
+++ hfsplus-0.7/extents.c	2023-11-11 18:35:09.984412209 +0000
@@ -554,15 +554,15 @@ void hfsplus_file_truncate(struct inode
 	if (inode->i_size > hip->phys_size) {
 		struct address_space *mapping = inode->i_mapping;
 		struct page *page;
-		void *fsdata;
+		void *fsdata = NULL;
 		loff_t size = inode->i_size;
 
-		res = pagecache_write_begin(NULL, mapping, size, 0, 0,
-					    &page, &fsdata);
+		res = hfsplus_write_begin(NULL, mapping, size, 0,
+					  &page, &fsdata);
 		if (res)
 			return;
-		res = pagecache_write_end(NULL, mapping, size,
-			0, 0, page, fsdata);
+		res = generic_write_end(NULL, mapping, size, 0, 0,
+					page, fsdata);
 		if (res < 0)
 			return;
 		mark_inode_dirty(inode);
diff -Naurp hfsplus-0.7.orig/hfsplus_fs.h hfsplus-0.7/hfsplus_fs.h
--- hfsplus-0.7.orig/hfsplus_fs.h	2023-10-03 13:09:50.000000000 +0100
+++ hfsplus-0.7/hfsplus_fs.h	2023-11-11 18:47:59.483965812 +0000
@@ -468,6 +468,8 @@ extern const struct address_space_operat
 extern const struct address_space_operations hfsplus_btree_aops;
 extern const struct dentry_operations hfsplus_dentry_operations;
 
+int hfsplus_write_begin(struct file *file, struct address_space *mapping,
+		loff_t pos, unsigned len, struct page **pagep, void **fsdata);
 struct inode *hfsplus_new_inode(struct super_block *sb, struct inode *dir,
 				umode_t mode);
 void hfsplus_delete_inode(struct inode *inode);
diff -Naurp hfsplus-0.7.orig/inode.c hfsplus-0.7/inode.c
--- hfsplus-0.7.orig/inode.c	2023-10-03 13:09:50.000000000 +0100
+++ hfsplus-0.7/inode.c	2023-11-11 18:54:53.750386508 +0000
@@ -43,7 +43,7 @@ static void hfsplus_write_failed(struct
 	}
 }
 
-static int hfsplus_write_begin(struct file *file, struct address_space *mapping,
+int hfsplus_write_begin(struct file *file, struct address_space *mapping,
 			loff_t pos, unsigned len,
 			struct page **pagep, void **fsdata)
 {

Issue History

Date Modified Username Field Change
2023-11-09 19:57 toracat New Issue
2023-11-09 19:57 toracat Status new => assigned
2023-11-09 19:57 toracat Assigned To => pperry
2023-11-11 10:30 pperry Note Added: 0009417
2023-11-11 14:03 pperry Note Added: 0009418
2023-11-11 14:03 pperry Status assigned => resolved
2023-11-11 14:03 pperry Resolution open => fixed
2023-11-11 14:05 toracat Note Added: 0009420
2023-11-12 11:59 pperry Note Added: 0009421
2023-11-12 11:59 pperry File Added: elrepo-hfsplus-convert_to_release_folio.el9_3.patch
2023-11-12 11:59 pperry File Added: elrepo-hfsplus-pagecache_write_begin_end.el9_3.patch