sfjro / aufs-standalone

27 stars 14 forks source link

Problem with kernel 5.10......... #41

Closed peabee closed 2 months ago

peabee commented 2 months ago

I know that support for aufs on kernel 5.10 has finished..... but am wondering if anyone can suggest why the latest 5.10.220 build with aufs-5.10.140 has suddenly started to fail:

2024-07-01T01:24:20.7089109Z Linux: 5.10.220 2024-07-01T01:24:20.7110980Z aufs=5.10.140 2024-07-01T01:24:20.7111420Z aufs_util=5.8

2024-07-01T01:32:46.6477385Z fs/aufs/vfsub.c: In function 'vfsub_rename':
2024-07-01T01:32:46.6586862Z fs/aufs/vfsub.c:420:19: error: passing argument 1 of 'vfs_rename' from incompatible pointer type [-Werror=incompatible-pointer-types]
2024-07-01T01:32:46.6588635Z   420 |  err = vfs_rename(src_dir, src_dentry, dir, path->dentry,
2024-07-01T01:32:46.6589688Z       |                   ^~~~~~~
2024-07-01T01:32:46.6594663Z       |                   |
2024-07-01T01:32:46.6595162Z       |                   struct inode *
2024-07-01T01:32:46.6595837Z In file included from ./include/linux/security.h:29,
2024-07-01T01:32:46.6596491Z                  from fs/aufs/vfsub.c:25:
2024-07-01T01:32:46.6597798Z ./include/linux/fs.h:1822:16: note: expected 'struct renamedata *' but argument is of type 'struct inode *'
2024-07-01T01:32:46.6598922Z  1822 | int vfs_rename(struct renamedata *);
2024-07-01T01:32:46.6599536Z       |                ^~~~~~~~~~~~~~~~~~~
2024-07-01T01:32:46.6600500Z fs/aufs/vfsub.c:420:8: error: too many arguments to function 'vfs_rename'
2024-07-01T01:32:46.6601610Z   420 |  err = vfs_rename(src_dir, src_dentry, dir, path->dentry,
2024-07-01T01:32:46.6602325Z       |        ^~~~~~~~~~
2024-07-01T01:32:46.6602886Z In file included from ./include/linux/security.h:29,
2024-07-01T01:32:46.6603543Z                  from fs/aufs/vfsub.c:25:
2024-07-01T01:32:46.6604177Z ./include/linux/fs.h:1822:5: note: declared here
2024-07-01T01:32:46.6604860Z  1822 | int vfs_rename(struct renamedata *);
2024-07-01T01:32:46.6605416Z       |     ^~~~~~~~~~
2024-07-01T01:32:46.6778319Z cc1: some warnings being treated as errors
2024-07-01T01:32:46.6828787Z make[2]: *** [scripts/Makefile.build:286: fs/aufs/vfsub.o] Error 1
2024-07-01T01:32:46.6833375Z make[1]: *** [scripts/Makefile.build:503: fs/aufs] Error 2
2024-07-01T01:32:46.6839292Z make: *** [Makefile:1832: fs] Error 2
2024-07-01T01:32:46.6840044Z make: *** Waiting for unfinished jobs....
sfjro commented 2 months ago

PB:

I know that support for aufs on kernel 5.10 has finished..... but am wondering if anyone can suggest why the latest 5.10.220 build with aufs-5.10.140 has suddenly started to fail:

v5.10.220 contains e864d4d834f8 2024-06-21 namei: introduce struct renamedata and its changes the parameter of vfs_rename(). The commit is originated to v5.12. 9fe61450972d 2021-01-24 namei: introduce struct renamedata

And aufs5.12 contains 85fab2b2001b 2021-03-06 aufs: v5.12-rc1 idmapper userns 1/2, new parameter

You need to backport it.

J. R. Okajima

peabee commented 2 months ago

J.R.O. - Many thanks for the insight - much appreciated. That looks to be a big "backport": 19 changed files with 227 additions and 107 deletions.

Can a patch be extracted from Github?? I think this probably means that 5.10 kernels from 5.10.220 onwards can no longer be produced in aufs versions - sadly.

sfjro commented 2 months ago

PB:

J.R.O. - Many thanks for the insight - much appreciated. That looks to be a big "backport": 19 changed files with 227 additions and 107 deletions.

Count it by commit. It is not so big.

$ git log1 --no-merges aufs5.10..aufs5.12 fs/aufs include/uapi/linux/aufs_type.h 9e5e47e46da7 2021-10-14 aufs: tiny, fix an editing failure 5cd24b8dc279 2021-04-27 aufs: version 5.12 6e046b556eee 2021-03-06 aufs: v5.12-rc1 idmapper userns 2/2, set path->mnt earlier 85fab2b2001b 2021-03-06 aufs: v5.12-rc1 idmapper userns 1/2, new parameter ccc9496d4919 2021-02-15 Revert "aufs: aufs5.11" 93ec4dd2c953 2021-02-15 aufs: aufs5.11 b9cb27885793 2021-01-09 aufs: for linux-v5.11-rc1, dummy def lockdep_is_held() 5bf2a1969bc4 2020-12-28 Revert "aufs: version 5.10"

But you need to check them all carefully whether v5.10.220 contains the corresponding part or not.

J. R. Okajima

jamesbond3142 commented 3 weeks ago

@peabee @sfjro

I'm late to the party ... but this patch (applied on top of aufs5.10.140) will make aufs builds (and works) again for 5.10.224 (and perhaps down to 5.10.220, I didn't test).

diff --git a/fs/aufs/hfsnotify.c b/fs/aufs/hfsnotify.c
index b029fa20..6b35e886 100644
--- a/fs/aufs/hfsnotify.c
+++ b/fs/aufs/hfsnotify.c
@@ -238,7 +238,8 @@ static int au_hfsn_init_br(struct au_branch *br, int perm)
        goto out;

    err = 0;
-   group = fsnotify_alloc_group(&au_hfsn_ops);
+   group = fsnotify_alloc_group(&au_hfsn_ops,
+                    /*flags - not for userspace*/0);
    if (IS_ERR(group)) {
        err = PTR_ERR(group);
        pr_err("fsnotify_alloc_group() failed, %d\n", err);
diff --git a/fs/aufs/vfsub.c b/fs/aufs/vfsub.c
index a85774c9..b2ef1db9 100644
--- a/fs/aufs/vfsub.c
+++ b/fs/aufs/vfsub.c
@@ -400,6 +400,7 @@ int vfsub_rename(struct inode *src_dir, struct dentry *src_dentry,
         struct inode **delegated_inode, unsigned int flags)
 {
    int err;
+   struct renamedata rd;
    struct path tmp = {
        .mnt    = path->mnt
    };
@@ -416,9 +417,14 @@ int vfsub_rename(struct inode *src_dir, struct dentry *src_dentry,
    if (unlikely(err))
        goto out;

+   rd.old_dir = src_dir;
+   rd.old_dentry = src_dentry;
+   rd.new_dir = dir;
+   rd.new_dentry = path->dentry;
+   rd.delegated_inode = delegated_inode;
+   rd.flags = flags;
    lockdep_off();
-   err = vfs_rename(src_dir, src_dentry, dir, path->dentry,
-            delegated_inode, flags);
+   err = vfs_rename(&rd);
    lockdep_on();
    if (!err) {
        int did;
jamesbond3142 commented 3 weeks ago

aufs5.10.224.diff.txt

Same diff file in a file attachment. Remove the extraneous .txt extension (which I had to append, or otherwise github will refuse to allow me to upload the diff).