Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't unmount union since 6.3.x #29

Closed
fulalas opened this issue Jun 25, 2023 · 37 comments
Closed

Can't unmount union since 6.3.x #29

fulalas opened this issue Jun 25, 2023 · 37 comments

Comments

@fulalas
Copy link

fulalas commented Jun 25, 2023

Hi!

I noticed that since kernel 6.3.0 during the shutdown/reboot process the system can no longer unmount /union (on Porteus 5, which mounts in the boot the whole system using aufs). By reverting the kernel to any 6.2.x it can unmount /union properly. This has been confirmed by many users.

Now, I don't know if this is an aufs issue or a kernel (upstream) issue. What I know is that using Porteus 5 with OverlayFS (instead of aufs) this issue doesn't happen.

These are the commands Porteus uses to unmount everything in the shutdown/reboot process:

umount -nl /union/*
umount -nl /union/mnt/*
umount /union

The last (third) command is the one that fails in 6.3.x with the message Device or resource busy, while in 6.2.x it unmounts without any complains.

It's funny because using 6.3.x I can cd /union, execute rm -fr * and it removes everything just fine, but /union itself is locked and can't be removed or unmounted.

Any ideas?

Thanks once again for the hard work! :)

@sfjro
Copy link
Owner

sfjro commented Jun 25, 2023 via email

@peabee
Copy link

peabee commented Jun 25, 2023

Hello @fulalas and @sfjro from the Puppy Linux community.
I'm not sure how many Puppy users are using the 6.3 kernel with aufs but there are certainly a few (3+ including me) and so far I haven't seen any problem reports. I'll PM this thread to the users I know about.
We can use the Porteus kernel in Puppy so if I get time I'll see if that shows any problems.
Regards
PeaBee

@peabee
Copy link

peabee commented Jun 25, 2023

Seems OK - no error messages on shutdown......
Screenshot

@porteux
Copy link

porteux commented Jun 26, 2023

@sfjro, thanks for the tips. Here's what I have so far:

kernel 6.3.9 (just before unmounting everything to reboot/shutdown) + nvidia driver:
image

image

image

And heaps more of screens like the ones above until this last one:

image

Now with kernel 6.2.11 + nvidia driver:

image

image

image

As you can see, for some reason kernel 6.3.x locks the whole system so the system can't unmount /union, while kernel 6.2.x doesn't.

As said, what's funny is that I can easily rm -fr /union/* (after unmounting its children, of course) and no single file is left, still I can't unmount it, and calling MagicSysrq (alt+print+a) prints the same long list of files in use.

In case you're wondering why I'm specifying '+ nvidia driver', that's because on my system if I don't use nvidia driver in 6.3.x it works perfectly:

image

Oh, in all scenarios lsof returns the same result:
4956537438524779273_121

We could blame nvidia but people on Porteus forum without nvidia card reported failure during /union unmount.

Question: when you updated your aufs project from 6.2.x to 6.3.x have you changed any part of the code apart from some adaptation to make it work on 6.3.x?

What's clear is that something has changed since 6.3.x. If it's the kernel or aufs or the combination of both or some mystical explanation, I don't know :D

Thanks once again!

@sfjro
Copy link
Owner

sfjro commented Jun 26, 2023 via email

@fulalas
Copy link
Author

fulalas commented Jun 26, 2023

@sfjro, thank you for the support.

No rush. Whenever you have time to look at this it will be great. If we can help you with your environment, let us know. :)

I'm wondering, if this is a bug in aufs why it didn't show up in 6.2.x and lower versions? I looked at your 2 commits and they look OK and small, although I'm not an expert in anything related to kernel.

@fulalas
Copy link
Author

fulalas commented Jun 29, 2023

Not sure if this helps, but the mount command used to load .xzm modules into the union is mount -no remount,add:1:"$MOD"=rr aufs /, where $MOD is pointing to the loop image previously mounted with mount -no loop,ro "$targetmod" "$MOD", where $targetmod is the module file path.

Also, not sure if this is related, but since util-linux 2.39 I can no longer mount .xzm modules into the union: util-linux/util-linux#2309 (comment)

@ncmprhnsbl
Copy link

ncmprhnsbl commented Jul 9, 2023

as far as i can see, this is to do with the util-linux mount regression. as seen in the util-linux#2309 issue the mount command : mount -no remount,add:1:"$MOD"=rr aufs / needs to be mount -no remount,add=1:"$MOD"=rr aufs / ...
similarly, for the removal: mount -t aufs -o remount,del:$MOD aufs should be mount -t aufs -o remount,del=$MOD aufs
.. kernel version doesn't seem to matter.
in my skimming of the manual(possibly not even the right version) the syntax/usage of remount,add/del seems a bit vague, perhaps some expansion could be useful in that area.

EDIT: ok :p on closer inspection, there's something else going on here causing 'unclean' unmounting on shutdown, with the newer kernels >6.3

@sfjro
Copy link
Owner

sfjro commented Jul 11, 2023 via email

@TurboBlaze
Copy link

Hello @sfjro
Any news?

Regards
Blaze

@sfjro
Copy link
Owner

sfjro commented Jul 22, 2023 via email

@sfjro
Copy link
Owner

sfjro commented Jul 25, 2023 via email

@fulalas
Copy link
Author

fulalas commented Jul 26, 2023

@sfjro, it seems your patch fixed the issue, yes! I didn't have time to make solid tests though. I'll let you know.

Thank you once again for the hard work!

@sfjro
Copy link
Owner

sfjro commented Jul 27, 2023 via email

@fulalas
Copy link
Author

fulalas commented Jul 31, 2023

@sfjro, I did more tests and unfortunately your patch doesn't fix the issue in all scenarios -- in my case, it fails using Nvidia drivers.

Other people in Porteus forum also reported your patch didn't fix the issue for them.

So I guess we need to continue investigating.

Thanks!

@sfjro
Copy link
Owner

sfjro commented Jul 31, 2023 via email

@sfjro
Copy link
Owner

sfjro commented Aug 2, 2023 via email

@sfjro
Copy link
Owner

sfjro commented Aug 3, 2023 via email

@fulalas
Copy link
Author

fulalas commented Aug 3, 2023

My local test is not bad, but it is doubtful that the patch will solve
the problem.

@sfjro, your guess is correct: this last patch unfortunately didn't fix the issue.

Now I'm considering removing aufs[56]-mmap.patch entirely.

I'm happy to test your last idea. How should I proceed? :)

@sfjro
Copy link
Owner

sfjro commented Aug 3, 2023 via email

@fulalas
Copy link
Author

fulalas commented Aug 3, 2023

I thought you were saying that we could remove all patches made to mmap.c file. Well, I tried but the system didn't work properly -- I could not even load the GUI.

@sfjro
Copy link
Owner

sfjro commented Aug 3, 2023 via email

@sfjro
Copy link
Owner

sfjro commented Aug 4, 2023 via email

@fulalas
Copy link
Author

fulalas commented Aug 4, 2023

@sfjro, I'm always patching and building from scratch, so I'm always applying the extra patches manually. Would it be easier to have a special branch for testing so I can just pull from it? :)

BTW, this patch (the one before the last) prevents the kernel to be built.

@fulalas
Copy link
Author

fulalas commented Aug 4, 2023

OK, good news! It seems it's fixed now! I applied all the patches in this thread, except this (because it breaks the build process), and the system is finally able to unmount everything now!

Gonna wait for more people from Porteus forum to confirm.

Nice work, man!
Thanks a lot!

@TurboBlaze
Copy link

TurboBlaze commented Aug 5, 2023

With @fulalas kernel I don't have anymore issue with unmount union at shutdowns/reboots in Porteus.
https://i.imgur.com/Of7n4HB.png
Thanks to @sfjro aka Junjiro Okajima for your hard work!

P.S. waiting a new aufs patch ;)

@sfjro
Copy link
Owner

sfjro commented Aug 5, 2023 via email

sfjro added a commit to sfjro/aufs-linux that referenced this issue Aug 13, 2023
linux-v6.3 introduced a new struct vma_prepare which contains 'file'
pointer (vm_file). Aufs mmap should handle it by vma_fput().

Reported-by: fulalas on github
See-also: sfjro/aufs-standalone#29
Signed-off-by: J. R. Okajima <hooanon05g@gmail.com>
@sfjro
Copy link
Owner

sfjro commented Aug 13, 2023 via email

@fulalas
Copy link
Author

fulalas commented Aug 21, 2023

@sfjro, do you have any plans to create a new branch for 6.4.x and 6.5.x?

Thanks!

@sfjro
Copy link
Owner

sfjro commented Aug 21, 2023 via email

@TurboBlaze
Copy link

Not bad to see aufs support for kernel 6.5.x

@peabee
Copy link

peabee commented Aug 27, 2023

As an experiment..... tried to apply aufs6.x-rcN to 6.5-rc7 ..........
One failure to patch fs/splice.c from aufs6-base.patch
patch -N -p1 < aufs6-base.patch
patching file fs/splice.c
Hunk #1 succeeded at 928 (offset 63 lines).
Hunk #2 FAILED at 876.
1 out of 2 hunks FAILED -- saving rejects to file fs/splice.c.rej

code doesn't seem to exist anymore.... splice.c.txt attached
splice.c.txt

@@ -876,9 +876,9 @@ static long do_splice_from(struct pipe_inode_info *pipe, struct file *out,
 /*
  * Attempt to initiate a splice from a file to a pipe.
  */
-static long do_splice_to(struct file *in, loff_t *ppos,
-			 struct pipe_inode_info *pipe, size_t len,
-			 unsigned int flags)
+long do_splice_to(struct file *in, loff_t *ppos,
+		  struct pipe_inode_info *pipe, size_t len,
+		  unsigned int flags)
 {
 	unsigned int p_space;
 	int ret;

@peabee
Copy link

peabee commented Aug 28, 2023

6.5 has been released....
@sfjro would it be possible to say what changes you think will be needed to aufs6-base.patch for splice.c in 6.5?
Many thanks

@sfjro
Copy link
Owner

sfjro commented Aug 28, 2023 via email

@peabee
Copy link

peabee commented Sep 4, 2023

Many thanks for aufs-6.4 and aufs-6.5

Kernel 6.5.1 built with aufs-6.5 and seems fine.... :-))

@fulalas
Copy link
Author

fulalas commented Sep 5, 2023

@sfjro, thanks a looot for the hard work. All recent branches are working flawlessly, including not only 6.3.x but also 6.4.x and 6.5.x. You're a hero! :)

I'm closing this issue.

@fulalas fulalas closed this as completed Sep 5, 2023
@sfjro
Copy link
Owner

sfjro commented Sep 5, 2023 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants