Skip to content

Permit filesystem local caching and NFS superblock sharing [try #11]

David Howells linux-fsdevel lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest30 patches 9 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/30NFS: Add dentry materialisation op [try #11]fs/dcache.c include/linux/dcache.h+151 -140 replies
2/30NFS: Fix up split of fs/nfs/inode.c [try #11]fs/nfs/callback.c fs/nfs/idmap.c fs/nfs/internal.h +1 more+39 -420 replies
3/30NFS: Disambiguate nfs_stat_to_errno() [try #11]fs/nfs/nfs4xdr.c+7 -70 replies
4/30NFS: Fix NFS4 callback up/down prototypes [try #11]fs/nfs/callback.c fs/nfs/callback.h+7 -50 replies
5/30NFS: Rename struct nfs4_client to struct nfs_client [try #11]fs/nfs/callback.c fs/nfs/callback_proc.c fs/nfs/delegation.c +10 more+105 -1050 replies
6/30NFS: Rename nfs_server::nfs4_state [try #11]fs/nfs/delegation.c fs/nfs/nfs4proc.c fs/nfs/nfs4renewd.c +4 more+34 -340 replies
7/30NFS: Return an error when starting the idmapping pipe [try #11]fs/nfs/idmap.c fs/nfs/super.c include/linux/nfs_idmap.h+11 -60 replies
8/30NFS: Add a lookupfh NFS RPC op [try #11]fs/nfs/nfs4proc.c include/linux/nfs_xdr.h+50 -00 replies
9/30NFS: Add a server capabilities NFS RPC op [try #11]fs/nfs/nfs4proc.c include/linux/nfs_xdr.h+2 -00 replies
10/30NFS: Generalise the nfs_client structure [try #11]fs/nfs/Makefile fs/nfs/callback.c fs/nfs/callback_proc.c +9 more+425 -2220 replies
11/30NFS: Use the dentry superblock directly in nfs_statfs() [try #11]fs/nfs/super.c+6 -70 replies
12/30NFS: Add extra const qualifiers [try #11]fs/nfs/namespace.c fs/nfs/nfs3proc.c fs/nfs/nfs4namespace.c +5 more+18 -170 replies
13/30NFS: Maintain a common server record for NFS2/3 as well as for NFS4 [try #11]fs/nfs/super.c include/linux/nfs_fs_sb.h+21 -20 replies
14/30NFS: Make better use of inode* dereferencing macros [try #11]fs/nfs/file.c fs/nfs/nfs4proc.c+6 -60 replies
15/30NFS: Move rpc_ops from nfs_server to nfs_client [try #11]fs/nfs/dir.c fs/nfs/inode.c fs/nfs/namespace.c +4 more+43 -340 replies
16/30NFS: Eliminate client_sys in favour of cl_rpcclient [try #11]fs/nfs/client.c fs/nfs/internal.h fs/nfs/nfs3proc.c +3 more+179 -1790 replies
17/30NFS: Start rpciod in server common management [try #11]fs/nfs/super.c+6 -250 replies
18/30NFS: Share NFS superblocks per-protocol per-server per-FSID [try #11]fs/nfs/Makefile fs/nfs/client.c fs/nfs/dir.c +15 more+1655 -9560 replies
19/30NFS: Add server and volume lists to /proc [try #11]fs/nfs/client.c fs/nfs/inode.c fs/nfs/internal.h+303 -00 replies
20/30NFS: Fix error handling [try #11]fs/nfs/client.c+3 -00 replies
21/30NFS: Secure the roots of the NFS subtrees in a shared superblock [try #11]fs/nfs/getroot.c+5 -00 replies
22/30FS-Cache: Provide a filesystem-specific sync'able page bit [try #11]fs/afs/dir.c fs/ext2/dir.c fs/ext3/inode.c +8 more+59 -290 replies
23/30FS-Cache: Generic filesystem caching facility [try #11]Documentation/filesystems/caching/backend-api.txt Documentation/filesystems/caching/fscache.txt Documentation/filesystems/caching/netfs-api.txt +10 more+3916 -00 replies
24/30FS-Cache: Release page->private in failed readahead [try #11]mm/readahead.c+23 -20 replies
25/30FS-Cache: Make kAFS use FS-Cache [try #11]fs/Kconfig fs/afs/cache.h fs/afs/cell.c +16 more+662 -4120 replies
26/30NFS: Use local caching [try #11]fs/Kconfig fs/nfs/Makefile fs/nfs/client.c +14 more+1010 -80 replies
27/30FS-Cache: CacheFiles: ia64: missing copy_page export [try #11]arch/ia64/kernel/ia64_ksyms.c+1 -00 replies
28/30FS-Cache: CacheFiles: A cache that backs onto a mounted filesystem [try #11]Documentation/filesystems/caching/cachefiles.txt fs/Kconfig fs/Makefile +17 more+4292 -00 replies
29/30AUTOFS: Make sure all dentries refs are released before calling kill_anon_super() [try #11]fs/autofs4/autofs_i.h fs/autofs4/init.c fs/autofs4/inode.c +1 more+6 -220 replies
30/30VFS: Destroy the dentries contributed by a superblock on unmounting [try #11]fs/dcache.c fs/super.c include/linux/dcache.h+140 -62 replies

Reviews trailers per patch

2 of 30 patches have a Reviewed-by or Acked-by.

PatchIan KentNeilBrown
1/30
2/30
3/30
4/30
5/30
6/30
7/30
8/30
9/30
10/30
11/30
12/30
13/30
14/30
15/30
16/30
17/30
18/30
19/30
20/30
21/30
22/30
23/30
24/30
25/30
26/30
27/30
28/30
29/30A-b
30/30A-b A-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH 00/30] Permit filesystem local caching and NFS superblock sharing [try #11]

These patches make it possible to share NFS superblocks between related mounts, where "related" means on the same server and FSID. Inodes and dentries will be shared where the NFS filehandles are the same (for example if two NFS3 files come from the same export but from different mounts, such as is not uncommon with autofs on /home).

These patches also add local caching for network filesystems such as NFS and AFS.

The patches can be grouped as:

(A) 01-21

NFS Superblock unification. Patches 01-19 are in Trond's NFS GIT tree.

(B) 22-25

Filesystem caching, including support for AFS.

(C) 26

Filesystem caching support for NFS; depends on (A) and (B).

(D) 27-28

CacheFiles: cache on files backend; depends on (B).

(E) 29-30

dentry cleanup during unmount optimisation. Patch 29 cleans up autofs4, patch 30 will make autofs4 oops during unmount if patch 29 isn't applied.

---
Changes [try #9] that have been made:

(*) [PATCH] NFS: Permit filesystem to perform statfs with a known root dentry

[*] Inclusions of linux/mount.h have been added where necessary to make
allyesconfig build successfully.

(*) [PATCH] NFS: Share NFS superblocks per-protocol per-server per-FSID

[*] The exports from fs/namespace.c and fs/namei.c are no longer required.

(*) [PATCH] FS-Cache: Release page->private in failed readahead

[*] The try_to_release_page() is called instead of calling the
releasepage() op directly.

[*] The page is locked before try_to_release_page() is called.

[*] The call to try_to_release_page() and page_cache_release() have been
abstracted out into a helper function as this bit of code occurs twice..

Changes [try #10] that have been made:

(*) [PATCH] NFS: Permit filesystem to perform statfs with a known root dentry

[*] Pass a dentry rather than a vfsmount to the statfs() op as the key by
which to determine the filesystem.

(*) [PATCH] NFS: Share NFS superblocks per-protocol per-server per-FSID

[*] nfs4_pathname_string() needed an extra const.

(*) [PATCH] FS-Cache: Release page->private in failed readahead

[*] The comment header on the helper function is much expanded. This
states why there's a need to call the releasepage() op in the event of an error.

[*] BUG() if the page is already locked when we try and lock it.

[*] Don't set the page mapping pointer until we've locked the page.

[*] The page is unlocked after try_to_release_page() is called.

(*) The release-page patch now comes before the fscache-afs patch as well as
the fscache-nfs patch.

Changes [try #11] that have been made:

(*) Split up of the NFS superblock sharing patches into a set of smaller
patches and reworked some of the contents as per Trond's suggestions.

(*) [PATCH] NFS: Fix error handling

[*] Fix error handling in earlier patches (the earlier patches are also in
Trond's NFS tree, so I haven't rolled this in for the moment).

(*) [PATCH] NFS: Secure the roots of the NFS subtrees in a shared superblock

[*] Initialise the security on detached NFS roots manually since they're
allocated with dcache_alloc_anon() not dcache_alloc_root().

(*) [PATCH] FS-Cache: CacheFiles: A cache that backs onto a mounted filesystem

[*] Don't use file structs when accessing the data storage backing files.
Pass NULL as the file argument to prepare_write() and commit_write() calls.

[*] Check for a bmap() inode op to prevent NFS being used as the cache
backing store (and besides, we need bmap() available anyway).

(*) [PATCH] FS-Cache: CacheFiles: ia64: missing copy_page export

[*] Export copy_page() on IA-64 as we need that.

(*) [PATCH] AUTOFS: Make sure all dentries refs are released before calling kill_anon_super()

[*] Make sure autofs4 releases all its retained dentries in its kill_sb()
op before calling kill_anon_super() rather than in the put_super() op. This prevents the next patch from oopsing it.

(*) [PATCH] VFS: Destroy the dentries contributed by a superblock on unmounting

[*] Optimise the destruction of the dentries attached to a superblock
during unmounting.

---
In response to those who've asked, there are at least three reasons for implementing superblock sharing:

(1) As I understand what I've been told, NFSv4 requires a 1:1 mapping between server files and client files. I suspect this has to do with the management of leases.

(2) We can reduce the resource consumption on NFSv2 and NFSv3 clients as well as on NFSv4 clients by sharing superblocks that cover overlapping segments of the file space.

Consider a machine that's used by a lot of people at the same time, each of whom has an automounted NFS homedir off of the same server - and in fact off of the same disk on the that server. Currently, with Linus's tree, each one will get a separate superblock to represent them; with Trond's tree, each one will still get a separate superblock unless they share the same root filehandle; and with my patches, they'll get the same superblock.

If two homedirs have a hard link between them (unlikely, I know, but by no means impossible, and probably more likely with, say, data such as NFS mounted git repositories), then you have the possibility of aliasing. This means that you can have two or more inodes in core that refer to the same server object, and each of these inodes can have pages that refer to the same remote pages on the server - aliasing again. You _have_ to have two inodes because they're covered by separate superblocks.

Aliasing is bad, generally, because you end up using more storage than you need to (pagecache and inode cache in this case), and you have the problem of keeping them in sync. It's also twice as hard to keep two inodes up to date when they change on the server as to keep one up to date.

If you can use the same superblock where possible, then you can cut out aliasing on that client since you can share dentries that have the same file handle (hard links or subtrees).

Part of the problem with NFSv2 and NFSv3 is that you invoke mountd to get the filehandle to a subtree, but you may not be able to work out how two different subtrees relate. The getsb patch permits the superblock to have more than one root, which allows us to defer this problem until we see the root of one subtree cropping up in another subtree - at which point we can splice the former into the latter.

(3) In my local file caching patches (FS-Cache), I have two reasons for wanting this:

(a) Unique keys. I need a unique key to find an object in the cache. If we can get inode aliases, then I end up with several inodes referring to the same cache object. This also means that I have to use a fair bit of extra memory to keep track of the multiple cookie mappings in FS-Cache, and have to compare keys a lot to find duplicate mappings.

If I can assume that the _netfs_ will manage the 1:1 mapping, I can use a lot less memory and save some processing capacity also.

I don't want to invent random keys to differentiate aliased superblocks or inodes as that destroys the persistence capabilities of the cache across power failures and reboots.

(b) Callbacks. I want a callback that the netfs passes to FS-Cache to permit the cache to update the metadata in the cache from netfs metadata at convenient times. However, if there's more than one inode alias in core, which one should the cache use?

AFS doesn't have anything like these problems because mounts are always made from the root of a volume, and AFS was designed with local caching in mind.

The getsb and statfs patches are a consequence of NFS being permitted to mount arbitrary subtrees from the server.

David