aboutsummaryrefslogtreecommitdiff
path: root/fs/nfs
AgeCommit message (Collapse)AuthorFilesLines
2020-01-15fs/nfs, swapon: check holes in swapfileMurphy Zhou1-0/+12
swapon over NFS does not go through generic_swapfile_activate code path when setting up extents. This makes holes in NFS swapfiles possible which is not expected for swapon. Signed-off-by: Murphy Zhou <[email protected]> Signed-off-by: Anna Schumaker <[email protected]>
2020-01-15NFS4: Report callback authentication errorsChuck Lever2-3/+43
This seems to be a somewhat common issue with Kerberos NFSv4.0 set-ups. Signed-off-by: Chuck Lever <[email protected]> Signed-off-by: Anna Schumaker <[email protected]>
2020-01-15NFS: Introduce trace events triggered by page writeback errorsChuck Lever2-0/+48
Try to capture the reason for the writeback path tagging an error on a page. Signed-off-by: Chuck Lever <[email protected]> Signed-off-by: Anna Schumaker <[email protected]>
2020-01-15NFS: move dprintk after nfs_alloc_fattr in nfs3_proc_lookupzhengbin1-1/+1
In nfs3_proc_lookup, if nfs_alloc_fattr fails, will only print "NFS call lookup". This may be confusing, move dprintk after nfs_alloc_fattr. Reported-by: Hulk Robot <[email protected]> Signed-off-by: zhengbin <[email protected]> Signed-off-by: Anna Schumaker <[email protected]>
2020-01-15NFS4: Remove unneeded semicolonzhengbin2-3/+3
Fixes coccicheck warning: fs/nfs/nfs4state.c:1138:2-3: Unneeded semicolon fs/nfs/nfs4proc.c:6862:2-3: Unneeded semicolon fs/nfs/nfs4proc.c:8629:2-3: Unneeded semicolon Reported-by: Hulk Robot <[email protected]> Signed-off-by: zhengbin <[email protected]> Signed-off-by: Anna Schumaker <[email protected]>
2020-01-15nfs: encode nfsv4 timestamps as 64-bitArnd Bergmann1-1/+1
On 32-bit architectures, xdr_encode_nfstime4() needlessly truncates timestamps to a 32-bit value in the range between year 1902 and 2038. Change it to use 'struct timespec64' to allow the entire range of values supported by the server. Signed-off-by: Arnd Bergmann <[email protected]> Signed-off-by: Anna Schumaker <[email protected]>
2020-01-15nfs: remove timespec from xdr_encode_nfstimeArnd Bergmann1-6/+6
For NFSv2 and NFSv3, timestamps are stored using 32-bit entities and overflow in y2038. For historic reasons we truncate the 64-bit timestamps by converting from a timespec64 to a timespec first. Remove this unnecessary conversion step and do the truncation in the final functions that take a timestamp. This is transparent to users, but avoids one of the last uses of 'timespec' and lets us remove it later. Signed-off-by: Arnd Bergmann <[email protected]> Signed-off-by: Anna Schumaker <[email protected]>
2020-01-15nfs: fscache: use timespec64 in inode auxdataArnd Bergmann3-11/+21
nfs currently behaves differently on 32-bit and 64-bit kernels regarding the on-disk format of nfs_fscache_inode_auxdata. That format should really be the same on any kernel, and we should avoid the 'timespec' type in order to remove that from the kernel later on. Using plain 'timespec64' would not be good here, since that includes implied padding and would possibly leak kernel stack data to the on-disk format on 32-bit architectures. struct __kernel_timespec would work as a replacement, but open-coding the two struct members in nfs_fscache_inode_auxdata makes it more obvious what's going on here, and keeps the current format for 64-bit architectures. Cc: David Howells <[email protected]> Signed-off-by: Arnd Bergmann <[email protected]> Signed-off-by: Anna Schumaker <[email protected]>
2020-01-15nfs: use timespec64 in nfs_fattrArnd Bergmann2-7/+7
Push down the use of timespec64 into NFS nfs_fattr, to avoid needless conversions, and get closer to having 64-bit time_t support on 32-bit NFSv4 and removing some old interfaces from the kernel. Signed-off-by: Arnd Bergmann <[email protected]> Signed-off-by: Anna Schumaker <[email protected]>
2020-01-15NFS: Attach supplementary error information to fs_context.Scott Mayhew6-72/+48
Split out from commit "NFS: Add fs_context support." Add wrappers nfs_errorf(), nfs_invalf(), and nfs_warnf() which log error information to the fs_context. Convert some printk's to use these new wrappers instead. Signed-off-by: Scott Mayhew <[email protected]> Signed-off-by: Anna Schumaker <[email protected]>
2020-01-15NFS: Additional refactoring for fs_context conversionScott Mayhew12-272/+203
Split out from commit "NFS: Add fs_context support." This patch adds additional refactoring for the conversion of NFS to use fs_context, namely: (*) Merge nfs_mount_info and nfs_clone_mount into nfs_fs_context. nfs_clone_mount has had several fields removed, and nfs_mount_info has been removed altogether. (*) Various functions now take an fs_context as an argument instead of nfs_mount_info, nfs_fs_context, etc. Signed-off-by: Scott Mayhew <[email protected]> Signed-off-by: Anna Schumaker <[email protected]>
2020-01-15NFS: Add fs_context support.David Howells11-656/+770
Add filesystem context support to NFS, parsing the options in advance and attaching the information to struct nfs_fs_context. The highlights are: (*) Merge nfs_mount_info and nfs_clone_mount into nfs_fs_context. This structure represents NFS's superblock config. (*) Make use of the VFS's parsing support to split comma-separated lists (*) Pin the NFS protocol module in the nfs_fs_context. (*) Attach supplementary error information to fs_context. This has the downside that these strings must be static and can't be formatted. (*) Remove the auxiliary file_system_type structs since the information necessary can be conveyed in the nfs_fs_context struct instead. (*) Root mounts are made by duplicating the config for the requested mount so as to have the same parameters. Submounts pick up their parameters from the parent superblock. [AV -- retrans is u32, not string] [SM -- Renamed cfg to ctx in a few functions in an earlier patch] [SM -- Moved fs_context mount option parsing to an earlier patch] [SM -- Moved fs_context error logging to a later patch] [SM -- Fixed printks in nfs4_try_get_tree() and nfs4_get_referral_tree()] [SM -- Added is_remount_fc() helper] [SM -- Deferred some refactoring to a later patch] [SM -- Fixed referral mounts, which were broken in the original patch] [SM -- Fixed leak of nfs_fattr when fs_context is freed] Signed-off-by: David Howells <[email protected]> Signed-off-by: Al Viro <[email protected]> Signed-off-by: Scott Mayhew <[email protected]> Signed-off-by: Anna Schumaker <[email protected]>
2020-01-15NFS: Convert mount option parsing to use functionality from fs_parser.hScott Mayhew1-423/+364
Split out from commit "NFS: Add fs_context support." Convert existing mount option definitions to fs_parameter_enum's and fs_parameter_spec's. Parse mount options using fs_parse() and lookup_constant(). Notes: 1) Fixed a typo in the udp6 definition in nfs_xprt_protocol_tokens from the original commit. 2) fs_parse() expects an fs_context as the first arg so that any errors can be logged to the fs_context. We're passing NULL for the fs_context (this will change in commit "NFS: Add fs_context support.") which is okay as it will cause logfc() to do a printk() instead. 3) fs_parse() expects an fs_paramter as the third arg. We're building an fs_parameter manually in nfs_fs_context_parse_option(), which will go away in commit "NFS: Add fs_context support.". Signed-off-by: Scott Mayhew <[email protected]> Signed-off-by: Anna Schumaker <[email protected]>
2020-01-15NFS: rename nfs_fs_context pointer arg in a few functionsScott Mayhew2-58/+58
Split out from commit "NFS: Add fs_context support." Rename cfg to ctx in nfs_init_server(), nfs_verify_authflavors(), and nfs_request_mount(). No functional changes. Signed-off-by: Scott Mayhew <[email protected]> Signed-off-by: Anna Schumaker <[email protected]>
2020-01-15NFS: Do some tidying of the parsing codeDavid Howells3-78/+66
Do some tidying of the parsing code, including: (*) Returning 0/error rather than true/false. (*) Putting the nfs_fs_context pointer first in some arg lists. (*) Unwrap some lines that will now fit on one line. (*) Provide unioned sockaddr/sockaddr_storage fields to avoid casts. (*) nfs_parse_devname() can paste its return values directly into the nfs_fs_context struct as that's where the caller puts them. Signed-off-by: David Howells <[email protected]> Signed-off-by: Al Viro <[email protected]> Signed-off-by: Anna Schumaker <[email protected]>
2020-01-15NFS: Add a small buffer in nfs_fs_context to avoid string dupDavid Howells2-52/+48
Add a small buffer in nfs_fs_context to avoid string duplication when parsing numbers. Also make the parsing function wrapper place the parsed integer directly in the appropriate nfs_fs_context struct member. Signed-off-by: David Howells <[email protected]> Signed-off-by: Al Viro <[email protected]> Signed-off-by: Anna Schumaker <[email protected]>
2020-01-15NFS: Deindent nfs_fs_context_parse_option()David Howells1-372/+367
Deindent nfs_fs_context_parse_option(). Signed-off-by: David Howells <[email protected]> Signed-off-by: Al Viro <[email protected]> Signed-off-by: Anna Schumaker <[email protected]>
2020-01-15NFS: Split nfs_parse_mount_options()David Howells2-56/+73
Split nfs_parse_mount_options() to move the prologue, list-splitting and epilogue into one function and the per-option processing into another. Signed-off-by: David Howells <[email protected]> Signed-off-by: Al Viro <[email protected]> Signed-off-by: Anna Schumaker <[email protected]>
2020-01-15NFS: Rename struct nfs_parsed_mount_data to struct nfs_fs_contextDavid Howells6-393/+393
Rename struct nfs_parsed_mount_data to struct nfs_fs_context and rename pointers to it to "ctx". At some point this will be pointed to by an fs_context struct's fs_private pointer. Signed-off-by: David Howells <[email protected]> Signed-off-by: Al Viro <[email protected]> Signed-off-by: Anna Schumaker <[email protected]>
2020-01-15NFS: Constify mount argument match tablesDavid Howells1-3/+3
The mount argument match tables should never be altered so constify them. Signed-off-by: David Howells <[email protected]> Signed-off-by: Al Viro <[email protected]> Signed-off-by: Anna Schumaker <[email protected]>
2020-01-15NFS: Move mount parameterisation bits into their own fileDavid Howells4-1412/+1445
Split various bits relating to mount parameterisation out from fs/nfs/super.c into their own file to form the basis of filesystem context handling for NFS. No other changes are made to the code beyond removing 'static' qualifiers. Signed-off-by: David Howells <[email protected]> Signed-off-by: Al Viro <[email protected]> Signed-off-by: Anna Schumaker <[email protected]>
2020-01-15nfs: get rid of ->set_security()Al Viro4-55/+21
it's always either nfs_set_sb_security() or nfs_clone_sb_security(), the choice being controlled by mount_info->cloned != NULL. No need to add methods, especially when both instances live right next to the caller and are never accessed anywhere else. Reviewed-by: David Howells <[email protected]> Signed-off-by: Al Viro <[email protected]> Signed-off-by: Anna Schumaker <[email protected]>
2020-01-15nfs_clone_sb_security(): simplify the check for server bogosityAl Viro1-1/+1
We used to check ->i_op for being nfs_dir_inode_operations. With separate inode_operations for v3 and v4 that became bogus, but rather than going for protocol-dependent comparison we could've just checked ->i_fop instead; _that_ is the same for all protocol versions. Reviewed-by: David Howells <[email protected]> Signed-off-by: Al Viro <[email protected]> Signed-off-by: Anna Schumaker <[email protected]>
2020-01-15nfs: get rid of mount_info ->fill_super()Al Viro4-64/+18
The only possible values are nfs_fill_super and nfs_clone_super. The latter is used only when crossing into a submount and it is almost identical to the former; the only differences are * ->s_time_gran unconditionally set to 1 (even for v2 mounts). Regression dating back to 2012, actually. * ->s_blocksize/->s_blocksize_bits set to that of parent. Rather than messing with the method, stash ->s_blocksize_bits in mount_info in submount case and after the (now unconditional) call of nfs_fill_super() override ->s_blocksize/->s_blocksize_bits if that has been set. Reviewed-by: David Howells <[email protected]> Signed-off-by: Al Viro <[email protected]> Signed-off-by: Anna Schumaker <[email protected]>
2020-01-15nfs: don't pass nfs_subversion to ->create_server()Al Viro7-21/+16
pick it from mount_info Reviewed-by: David Howells <[email protected]> Signed-off-by: Al Viro <[email protected]> Signed-off-by: Anna Schumaker <[email protected]>
2020-01-15nfs: unexport nfs_fs_mount_common()Al Viro2-5/+3
Make it static, even. And remove a stale extern of (long-gone) nfs_xdev_mount_common() from internal.h, while we are at it. Reviewed-by: David Howells <[email protected]> Signed-off-by: Al Viro <[email protected]> Signed-off-by: Anna Schumaker <[email protected]>
2020-01-15nfs: merge xdev and remote file_system_typeAl Viro4-29/+11
they are identical now... Reviewed-by: David Howells <[email protected]> Signed-off-by: Al Viro <[email protected]> Signed-off-by: Anna Schumaker <[email protected]>
2020-01-15nfs: don't bother passing nfs_subversion to ->try_mount() and ↵Al Viro4-19/+13
nfs_fs_mount_common() Reviewed-by: David Howells <[email protected]> Signed-off-by: Al Viro <[email protected]> Signed-off-by: Anna Schumaker <[email protected]>
2020-01-15nfs: stash nfs_subversion reference into nfs_mount_infoAl Viro4-3/+6
That will allow to get rid of passing those references around in quite a few places. Moreover, that will allow to merge xdev and remote file_system_type. Reviewed-by: David Howells <[email protected]> Signed-off-by: Al Viro <[email protected]> Signed-off-by: Anna Schumaker <[email protected]>
2020-01-15nfs: lift setting mount_info from nfs_xdev_mount()Al Viro3-37/+26
Do it in nfs_do_submount() instead. As a side benefit, nfs_clone_data doesn't need ->fh and ->fattr anymore. Reviewed-by: David Howells <[email protected]> Signed-off-by: Al Viro <[email protected]> Signed-off-by: Anna Schumaker <[email protected]>
2020-01-15nfs4: fold nfs_do_root_mount/nfs_follow_remote_pathAl Viro1-51/+37
Reviewed-by: David Howells <[email protected]> Signed-off-by: Al Viro <[email protected]> Signed-off-by: Anna Schumaker <[email protected]>
2020-01-15nfs: don't bother setting/restoring export_path around do_nfs_root_mount()Al Viro1-4/+0
nothing in it will be looking at that thing anyway Reviewed-by: David Howells <[email protected]> Signed-off-by: Al Viro <[email protected]> Signed-off-by: Anna Schumaker <[email protected]>
2020-01-15nfs: fold nfs4_remote_fs_type and nfs4_remote_referral_fs_typeAl Viro1-22/+4
They are identical now. Reviewed-by: David Howells <[email protected]> Signed-off-by: Al Viro <[email protected]> Signed-off-by: Anna Schumaker <[email protected]>
2020-01-15nfs: lift setting mount_info from nfs4_remote{,_referral}_mountAl Viro1-32/+35
Do that (fhandle allocation, setting struct server up) in nfs4_referral_mount() and nfs4_try_mount() resp. and pass the server and pointer to mount_info into nfs_do_root_mount() so that nfs4_remote_referral_mount()/nfs_remote_mount() could be merged. Since we are moving stuff from ->mount() instances to the points prior to vfs_kern_mount() that would trigger those, we need to make sure that do_nfs_root_mount() will do the corresponding cleanup itself if it doesn't trigger those ->mount() instances. Reviewed-by: David Howells <[email protected]> Signed-off-by: Al Viro <[email protected]> Signed-off-by: Anna Schumaker <[email protected]>
2020-01-15nfs: stash server into struct nfs_mount_infoAl Viro3-18/+14
Reviewed-by: David Howells <[email protected]> Signed-off-by: Al Viro <[email protected]> Signed-off-by: Anna Schumaker <[email protected]>
2020-01-15saner calling conventions for nfs_fs_mount_common()Al Viro2-22/+5
Allow it to take ERR_PTR() for server and return ERR_CAST() of it in such case. All callers used to open-code that... Reviewed-by: David Howells <[email protected]> Signed-off-by: Al Viro <[email protected]> Signed-off-by: Anna Schumaker <[email protected]>
2020-01-15reimplement path_mountpoint() with less magicAl Viro1-2/+0
... and get rid of a bunch of bugs in it. Background: the reason for path_mountpoint() is that umount() really doesn't want attempts to revalidate the root of what it's trying to umount. The thing we want to avoid actually happen from complete_walk(); solution was to do something parallel to normal path_lookupat() and it both went overboard and got the boilerplate subtly (and not so subtly) wrong. A better solution is to do pretty much what the normal path_lookupat() does, but instead of complete_walk() do unlazy_walk(). All it takes to avoid that ->d_weak_revalidate() call... mountpoint_last() goes away, along with everything it got wrong, and so does the magic around LOOKUP_NO_REVAL. Another source of bugs is that when we traverse mounts at the final location (and we need to do that - umount . expects to get whatever's overmounting ., if any, out of the lookup) we really ought to take care of ->d_manage() - as it is, manual umount of autofs automount in progress can lead to unpleasant surprises for the daemon. Easily solved by using handle_lookup_down() instead of follow_mount(). Tested-by: Ian Kent <[email protected]> Signed-off-by: Al Viro <[email protected]>
2019-12-18nfs: fscache: use timespec64 in inode auxdataArnd Bergmann3-11/+21
nfs currently behaves differently on 32-bit and 64-bit kernels regarding the on-disk format of nfs_fscache_inode_auxdata. That format should really be the same on any kernel, and we should avoid the 'timespec' type in order to remove that from the kernel later on. Using plain 'timespec64' would not be good here, since that includes implied padding and would possibly leak kernel stack data to the on-disk format on 32-bit architectures. struct __kernel_timespec would work as a replacement, but open-coding the two struct members in nfs_fscache_inode_auxdata makes it more obvious what's going on here, and keeps the current format for 64-bit architectures. Cc: David Howells <[email protected]> Signed-off-by: Arnd Bergmann <[email protected]>
2019-12-18nfs: fix timstamp debug printsArnd Bergmann1-5/+5
Starting in v5.5, the timestamps are correctly passed down as 64-bit seconds with NFSv4 on 32-bit machines, but some debug statements still truncate them to 'long'. Fixes: e86d5a02874c ("NFS: Convert struct nfs_fattr to use struct timespec64") Signed-off-by: Arnd Bergmann <[email protected]>
2019-11-18NFS4: Trace lock reclaimsChuck Lever3-2/+83
One of the most frustrating messages our sustaining team sees is the "Lock reclaim failed!" message. Add some observability in the client's lock reclaim logic so we can capture better data the first time a problem occurs. Signed-off-by: Chuck Lever <[email protected]> Signed-off-by: Trond Myklebust <[email protected]>
2019-11-18NFS4: Trace state recovery operationChuck Lever2-0/+96
Add a trace point in the main state manager loop to observe state recovery operation. Help track down state recovery bugs. Signed-off-by: Chuck Lever <[email protected]> Signed-off-by: Trond Myklebust <[email protected]>
2019-11-18NFSv4.2 fix memory leak in nfs42_ssc_openOlga Kornievskaia1-4/+6
Static analysis with Coverity detected a memory leak Reported-by: Colin King <[email protected]> Fixes: ec4b09250898 ("NFS: inter ssc open") Signed-off-by: Olga Kornievskaia <[email protected]> Signed-off-by: Trond Myklebust <[email protected]>
2019-11-18NFSv4.2 fix kfree in __nfs42_copy_file_rangeOlga Kornievskaia1-1/+2
This is triggering problems with static analysis with Coverity Reported-by: Colin King <[email protected]> Signed-off-by: Olga Kornievskaia <[email protected]> Signed-off-by: Trond Myklebust <[email protected]>
2019-11-18NFS: remove duplicated include from nfs4file.cYueHaibing1-1/+0
Remove duplicated include. Signed-off-by: YueHaibing <[email protected]> Signed-off-by: Trond Myklebust <[email protected]>
2019-11-18NFSv4: Make _nfs42_proc_copy_notify() staticYueHaibing1-3/+3
Fix sparse warning: fs/nfs/nfs42proc.c:527:5: warning: symbol '_nfs42_proc_copy_notify' was not declared. Should it be static? Reported-by: Hulk Robot <[email protected]> Signed-off-by: YueHaibing <[email protected]> Signed-off-by: Trond Myklebust <[email protected]>
2019-11-18NFS: Fallocate should use the nfs4_fattr_bitmapAnna Schumaker1-1/+1
Changing a sparse file could have an effect not only on the file size, but also on the number of blocks used by the file in the underlying filesystem. The server's cache_consistency_bitmap doesn't update the SPACE_USED attribute, so let's switch to the nfs4_fattr_bitmap to catch this update whenever we do an ALLOCATE or DEALLOCATE. This patch fixes xfstests generic/568, which tests that fallocating an unaligned range allocates all blocks touched by that range. Without this patch, `stat` reports 0 bytes used immediately after the fallocate. Adding a `sleep 5` to the test also catches the update, but it's better to do so when we know something has changed. Signed-off-by: Anna Schumaker <[email protected]> Signed-off-by: Trond Myklebust <[email protected]>
2019-11-18NFS: Return -ETXTBSY when attempting to write to a swapfileAnna Schumaker1-1/+1
My understanding is that -EBUSY refers to the underlying device, and that -ETXTBSY is used when attempting to access a file in use by the kernel (like a swapfile). Changing this return code helps us pass xfstests generic/569 Signed-off-by: Anna Schumaker <[email protected]> Signed-off-by: Trond Myklebust <[email protected]>
2019-11-18fs: nfs: sysfs: Remove NULL check before kfreeSaurav Girepunje1-2/+1
Remove NULL check before kfree, NULL check is taken care on kfree. Signed-off-by: Saurav Girepunje <[email protected]> Signed-off-by: Trond Myklebust <[email protected]>
2019-11-18NFS: remove unneeded semicolonYueHaibing1-3/+3
remove unneeded semicolon. Signed-off-by: YueHaibing <[email protected]> Signed-off-by: Trond Myklebust <[email protected]>
2019-11-18NFSv4: add declaration of current_stateidBen Dooks3-5/+5
The current_stateid is exported from nfs4state.c but not declared in any of the headers. Add to nfs4_fs.h to remove the following warning: fs/nfs/nfs4state.c:80:20: warning: symbol 'current_stateid' was not declared. Should it be static? Signed-off-by: Ben Dooks <[email protected]> Signed-off-by: Trond Myklebust <[email protected]>