linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Swapping fs root inode without unmounting
@ 2025-03-07 15:39 tzsz
  2025-03-10  8:04 ` Christian Brauner
  0 siblings, 1 reply; 2+ messages in thread
From: tzsz @ 2025-03-07 15:39 UTC (permalink / raw)
  To: linux-fsdevel

Hello!

We are currently developing a snapshot feature for a small university 
project. And for this reason we are looking for a way to swap out the 
root inode of our (mounted) fs.
Internally we have a set of root inodes and we'd like to swap them out 
at will without unmounting the entire filesystem.

Is there any function/way how to do this properly?

So far we tried the following:
  -> swapping dentry: setting sb->s_root
     -> causes a lot of problems regarding inode ref counting (I_CLEAR flag)
  -> looking into fs_context (doesnt seem like this is appropriate here)
  -> we did not find anything related within the vfs.rst docs

Furthermore, we cannot mount those other root inodes at different 
mountpoints. All changes have to be live and in-place.

Kind regards


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Swapping fs root inode without unmounting
  2025-03-07 15:39 Swapping fs root inode without unmounting tzsz
@ 2025-03-10  8:04 ` Christian Brauner
  0 siblings, 0 replies; 2+ messages in thread
From: Christian Brauner @ 2025-03-10  8:04 UTC (permalink / raw)
  To: tzsz; +Cc: linux-fsdevel

On Fri, Mar 07, 2025 at 04:39:21PM +0100, tzsz wrote:
> Hello!
> 
> We are currently developing a snapshot feature for a small university
> project. And for this reason we are looking for a way to swap out the root
> inode of our (mounted) fs.
> Internally we have a set of root inodes and we'd like to swap them out at
> will without unmounting the entire filesystem.
> 
> Is there any function/way how to do this properly?

See btrfs_get_tree(), mount_subvol(), and mount_subtree() in
fs/btrfs/super.c

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-03-10  8:04 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-07 15:39 Swapping fs root inode without unmounting tzsz
2025-03-10  8:04 ` Christian Brauner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).