Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[solved] Root on nilfs - garbage collection doesn't start
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
szatox
Advocate
Advocate


Joined: 27 Aug 2013
Posts: 3151

PostPosted: Thu Jul 20, 2017 9:23 pm    Post subject: [solved] Root on nilfs - garbage collection doesn't start Reply with quote

I decided to give nilfs a shot. The trick is, this filesystem requires a garbage collection process (which runs as a userspace process) to stop it from choking.
Usually this process is started during mount, but it's not strictly required (can be disabled with options) and - apparently - it does not start if kernel can't read it because root is not mounted yet.
I can either start it later on manually, or invoke 'mount -o remount /', which also starts garbage collection at this point, even though mount options haven't changed.

Question is: is there a smarter way to do that than adding my own service that would remount root? I might go with custom initramfs again one day (and solve it there), but for now I'm building stuff with genkernel and using openrc, for the simple reason it's faster than doing everything myself.


Last edited by szatox on Fri Jul 21, 2017 10:18 pm; edited 1 time in total
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54310
Location: 56N 3W

PostPosted: Thu Jul 20, 2017 10:16 pm    Post subject: Reply with quote

szatox,

Add it to /etc/local.d/

You need a file called nilfs.start containing the line mount -o remount /
chmod +x the file.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
szatox
Advocate
Advocate


Joined: 27 Aug 2013
Posts: 3151

PostPosted: Thu Jul 20, 2017 10:38 pm    Post subject: Reply with quote

Yes, I am aware of rc.local. I don't like it because it's ugly and hackish. However, the vast majority of systems has no use of runlevels, so I guess it's good enough.
I can't really think of an actually good way to do that in userspace. It would be nice to have kernel module handle it internally, but it would certainly turn out much more hackish. And it probably is a userspace process for a reason. Even if the reason is "userspace stuff is easier to write".

Thanks
Back to top
View user's profile Send private message
russK
l33t
l33t


Joined: 27 Jun 2006
Posts: 665

PostPosted: Fri Jul 21, 2017 6:11 am    Post subject: Reply with quote

Is it OK to periodically remount? How about a cron job?
Back to top
View user's profile Send private message
szatox
Advocate
Advocate


Joined: 27 Aug 2013
Posts: 3151

PostPosted: Fri Jul 21, 2017 6:01 pm    Post subject: Reply with quote

Cron is not needed here, since garbage collector is a deamon process. It can be started manually, or automatically when you mount a filesystem.
Starting it automatically is a better option, because this way kernel is aware of this deamon making things more managable. E.g. GC will die when you unmount that FS so you don't have to think about it.
I suppose the problem here originates from FS not being readable _yet_ when it's being mounted for the first time (so kernel can't read and start the GC) and once root is mounted, kernel has no reason to mount it again so the event spawning GC deamon never occurs when it could be served.
With secondary mountpoints it "just works"™

Basically the best thing I can think of would be a /etc/fstab entry forcing mount -a to take it into consideration. However, mount is smart enough to only mount those filesystems that are not already mounted.
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54310
Location: 56N 3W

PostPosted: Fri Jul 21, 2017 6:48 pm    Post subject: Reply with quote

szatox,

Doesn't the kernel do a remount anyway?

First mount read only, so rootfsck can run, then a remount rw?
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
szatox
Advocate
Advocate


Joined: 27 Aug 2013
Posts: 3151

PostPosted: Fri Jul 21, 2017 10:17 pm    Post subject: Reply with quote

Bingo!
You gave me a good idea.
I changed a few things in openrc scripts (to print mounts at various points during boot), and entered debug mode in initramfs and I found out this little bit in /etc/init.d/root:
Code:
mount -n -o remount,rw /

Guess what... -n is not needed anymore. It used to be, when /etc/mtab was a file, but it's just a symlink those days. I changed it to
Code:
mount -o remount,rw /
, rebooted and... nilfs_cleanerd is running! Yay!
Turns out that this "updating mtab" part is being used for a trigger.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum