summaryrefslogtreecommitdiff
path: root/fs/nfs
Commit message (Collapse)AuthorAgeFilesLines
...
| * pNFS/flexfiles: remove requirement for whole file layoutsTrond Myklebust2020-03-271-21/+0
| | | | | | | | | | | | | | Remove the requirement that the server always sends whole file layouts. Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
| * pNFS/flexfiles: Check the layout segment range before doing I/OTrond Myklebust2020-03-273-3/+13
| | | | | | | | | | | | | | When starting to read or write with a layout segment, check that the range matches our request. Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
| * pNFS/flexfile: Don't merge layout segments if the mirrors don't matchTrond Myklebust2020-03-271-0/+19
| | | | | | | | | | | | | | Check that the number of mirrors, and the mirror information matches before deciding to merge layout segments in pNFS/flexfiles. Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
| * NFS/pNFS: Fix pnfs_layout_mark_request_commit() invalid layout segment handlingTrond Myklebust2020-03-271-16/+12
| | | | | | | | | | | | | | Fix up pnfs_layout_mark_request_commit() to alway reschedule the write if the layout segment is invalid. Also minor cleanup. Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
| * NFS/pNFS: Simplify bucket layout segment reference countingTrond Myklebust2020-03-271-19/+20
| | | | | | | | Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
| * NFS/pNFS: Clean up pNFS commit operationsTrond Myklebust2020-03-275-71/+97
| | | | | | | | | | | | | | Move the pNFS commit related operations into a separate structure that can be carried by the pnfs_ds_commit_info. Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
| * NFS: Remove bucket array from struct pnfs_ds_commit_infoTrond Myklebust2020-03-275-172/+1
| | | | | | | | | | | | Remove the unused bucket array in struct pnfs_ds_commit_info. Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
| * NFS/pNFS: Add a helper pnfs_generic_search_commit_reqs()Trond Myklebust2020-03-273-31/+54
| | | | | | | | | | | | | | Lift filelayout_search_commit_reqs() into the generic pnfs/nfs code, and add support for commit arrays. Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
| * pNFS: Enable per-layout segment commit structuresTrond Myklebust2020-03-274-6/+117
| | | | | | | | | | | | | | Enable adding and lookup of per-layout segment commits in filelayout and flexfilelayout. Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
| * pNFS: Add infrastructure for cleaning up per-layout commit structuresTrond Myklebust2020-03-276-4/+120
| | | | | | | | | | | | | | Ensure that both the file and flexfiles layout types clean up when freeing the layout segments. Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
| * NFS/pNFS: Support commit arrays in nfs_clear_pnfs_ds_commit_verifiers()Trond Myklebust2020-03-271-3/+16
| | | | | | | | | | | | | | Add support for scanning the full list of per-layout segment commit arrays to nfs_clear_pnfs_ds_commit_verifiers(). Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
| * NFS: Fix O_DIRECT commit verifier handlingTrond Myklebust2020-03-273-124/+22
| | | | | | | | | | | | | | | | Instead of trying to save the commit verifiers and checking them against previous writes, adopt the same strategy as for buffered writes, of just checking the verifiers at commit time. Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
| * NFS: commit errors should be fatalTrond Myklebust2020-03-271-2/+30
| | | | | | | | | | | | | | Fix the O_DIRECT code to avoid retries if the COMMIT fails with a fatal error. Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
| * NFS/pNFS: Allow O_DIRECT to release the DS commitinfoTrond Myklebust2020-03-272-0/+17
| | | | | | | | | | | | | | Add a pNFS callback to allow the O_DIRECT code to release the DS commitinfo when freeing the dreq. Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
| * pNFS: Support per-layout segment commits in pnfs_generic_commit_pagelist()Trond Myklebust2020-03-271-0/+16
| | | | | | | | | | | | | | Add support for scanning the full list of per-layout segment commit arrays to pnfs_generic_commit_pagelist(). Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
| * pNFS: Support per-layout segment commits in pnfs_generic_recover_commit_reqs()Trond Myklebust2020-03-271-8/+33
| | | | | | | | | | | | | | Add support for scanning the full list of per-layout segment commit arrays to pnfs_generic_recover_commit_reqs(). Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
| * NFSv4/pNFS: Scan the full list of commit arrays when committingTrond Myklebust2020-03-271-12/+40
| | | | | | | | | | | | | | Add support for scanning the full list of per-layout segment commit arrays to pnfs_generic_scan_commit_lists() Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
| * NFSv4/pnfs: Support a list of commit arrays in struct pnfs_ds_commit_infoTrond Myklebust2020-03-274-1/+17
| | | | | | | | | | | | | | | | | | When we have multiple layout segments with different lists of mirrored data, we need to track the commits on a per layout segment basis. This patch adds a list to support this tracking in struct pnfs_ds_commit_info. Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
| * pNFS: Add a helper to allocate the array of bucketsTrond Myklebust2020-03-262-0/+34
| | | | | | | | Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
| * NFS/pNFS: Refactor pnfs_generic_commit_pagelist()Trond Myklebust2020-03-262-101/+76
| | | | | | | | | | | | | | Refactor pnfs_generic_commit_pagelist() to simplify the conversion to layout segment based commit lists. Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
| * pNFS/flexfiles: Simplify allocation of the mirror arrayTrond Myklebust2020-03-262-17/+6
| | | | | | | | | | | | | | Just allocate the array at the end of the layout segment structure, instead of allocating it as a separate array of pointers. Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
| * NFS: Don't specify NFS version in "UDP not supported" errorPetr Vorel2020-03-251-2/+2
| | | | | | | | | | | | | | | | | | | | | | UDP was originally disabled in 6da1a034362f for NFSv4. Later in b24ee6c64ca7 UDP is by default disabled by NFS_DISABLE_UDP_SUPPORT=y for all NFS versions. Therefore remove v4 from error message. Fixes: b24ee6c64ca7 ("NFS: allow deprecation of NFS UDP protocol") Signed-off-by: Petr Vorel <pvorel@suse.cz> Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
| * nfsroot: set tcp as the default transport protocolLiwei Song2020-03-251-1/+1
| | | | | | | | | | | | | | | | | | | | | | UDP is disabled by default in commit b24ee6c64ca7 ("NFS: allow deprecation of NFS UDP protocol"), but the default mount options is still udp, change it to tcp to avoid the "Unsupported transport protocol udp" error if no protocol is specified when mount nfs. Fixes: b24ee6c64ca7 ("NFS: allow deprecation of NFS UDP protocol") Signed-off-by: Liwei Song <liwei.song@windriver.com> Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
| * NFS: direct.c: Fix memory leak of dreq when nfs_get_lock_context failsMisono Tomohiro2020-03-221-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When dreq is allocated by nfs_direct_req_alloc(), dreq->kref is initialized to 2. Therefore we need to call nfs_direct_req_release() twice to release the allocated dreq. Usually it is called in nfs_file_direct_{read, write}() and nfs_direct_complete(). However, current code only calls nfs_direct_req_relese() once if nfs_get_lock_context() fails in nfs_file_direct_{read, write}(). So, that case would result in memory leak. Fix this by adding the missing call. Signed-off-by: Misono Tomohiro <misono.tomohiro@jp.fujitsu.com> Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
| * nfs: Fix up documentation in nfs_follow_referral() and nfs_do_submount()Trond Myklebust2020-03-172-5/+2
| | | | | | | | | | | | Fallout from the mount patches. Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
| * nfs: Replace zero-length array with flexible-array memberGustavo A. R. Silva2020-03-162-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The current codebase makes use of the zero-length array language extension to the C90 standard, but the preferred mechanism to declare variable-length types such as these ones is a flexible array member[1][2], introduced in C99: struct foo { int stuff; struct boo array[]; }; By making use of the mechanism above, we will get a compiler warning in case the flexible array does not occur last in the structure, which will help us prevent some kind of undefined behavior bugs from being inadvertently introduced[3] to the codebase from now on. Also, notice that, dynamic memory allocations won't be affected by this change: "Flexible array members have incomplete type, and so the sizeof operator may not be applied. As a quirk of the original implementation of zero-length arrays, sizeof evaluates to zero."[1] This issue was found with the help of Coccinelle. [1] https://gcc.gnu.org/onlinedocs/gcc/Zero-Length.html [2] https://github.com/KSPP/linux/issues/21 [3] commit 76497732932f ("cxgb3/l2t: Fix undefined behaviour") Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com> Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
| * NFSv4.2: error out when relink swapfileMurphy Zhou2020-03-161-0/+3
| | | | | | | | | | | | | | This fixes xfstests generic/356 failure on NFSv4.2. Signed-off-by: Murphy Zhou <jencce.kernel@gmail.com> Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
| * NFS:remove redundant call to nfs_do_accessZhouyi Zhou2020-03-161-8/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In function nfs_permission: 1. the rcu_read_lock and rcu_read_unlock around nfs_do_access is unnecessary because the rcu critical data structure is already protected in subsidiary function nfs_access_get_cached_rcu. No other data structure needs rcu_read_lock in nfs_do_access. 2. call nfs_do_access once is enough, because: 2-1. when mask has MAY_NOT_BLOCK bit The second call to nfs_do_access will not happen. 2-2. when mask has no MAY_NOT_BLOCK bit The second call to nfs_do_access will happen if res == -ECHILD, which means the first nfs_do_access goes out after statement if (!may_block). The second call to nfs_do_access will go through this procedure once again except continue the work after if (!may_block). But above work can be performed by only one call to nfs_do_access without mangling the mask flag. Tested in x86_64 Signed-off-by: Zhouyi Zhou <zhouzhouyi@gmail.com> Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
| * NFSv4: Add support for CB_RECALL_ANY for flexfiles layoutsTrond Myklebust2020-03-167-18/+186
| | | | | | | | | | | | | | | | | | When we receive a CB_RECALL_ANY that asks us to return flexfiles layouts, we iterate through all the layouts and look at whether or not there are active open file descriptors that might need them for I/O. If there are no such descriptors, we return the layouts. Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
| * NFSv4: Clean up nfs_delegation_reap_expired()Trond Myklebust2020-03-161-43/+40
| | | | | | | | | | | | Convert to use nfs_client_for_each_server() for efficiency. Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
| * NFSv4: Clean up nfs_delegation_reap_unclaimed()Trond Myklebust2020-03-161-39/+37
| | | | | | | | | | | | | | Convert nfs_delegation_reap_unclaimed() to use nfs_client_for_each_server() for efficiency. Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
| * NFSv4: Clean up nfs_client_return_marked_delegations()Trond Myklebust2020-03-161-69/+60
| | | | | | | | | | | | | | | | | | Convert it to use the nfs_client_for_each_server() helper, and make it more efficient by skipping delegations for inodes we know are in the process of being freed. Also improve the efficiency of the cursor by skipping delegations that are being freed. Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
| * NFS: Add a helper nfs_client_for_each_server()Trond Myklebust2020-03-162-1/+38
| | | | | | | | | | | | | | | | Add a helper nfs_client_for_each_server() to iterate through all the filesystems that are attached to a struct nfs_client, and apply a function to all the active ones. Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
| * NFSv4/pnfs: Clean up nfs_layout_find_inode()Trond Myklebust2020-03-161-31/+21
| | | | | | | | | | | | | | Now that we can rely on just the rcu_read_lock(), remove the clp->cl_lock and clean up. Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
| * NFSv4: Ensure layout headers are RCU safeTrond Myklebust2020-03-165-11/+13
| | | | | | | | Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
| * NFSv4/pnfs: Return valid stateids in nfs_layout_find_inode_by_stateid()Trond Myklebust2020-03-161-0/+2
| | | | | | | | | | | | | | | | | | Make sure to test the stateid for validity so that we catch instances where the server may have been reusing stateids in nfs_layout_find_inode_by_stateid(). Fixes: 7b410d9ce460 ("pNFS: Delay getting the layout header in CB_LAYOUTRECALL handlers") Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
| * pNFS/flexfiles: Report DELAY and GRACE errors from the DS to the serverTrond Myklebust2020-03-161-9/+11
| | | | | | | | | | | | | | Ensure that if the DS is returning too many DELAY and GRACE errors, we also report that to the MDS through the layouterror mechanism. Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
| * NFS: Limit the size of the access cache by defaultTrond Myklebust2020-03-161-1/+1
| | | | | | | | | | | | | | | | | | Currently, we have no real limit on the access cache size (we set it to ULONG_MAX). That can lead to credentials getting pinned for a very long time on lots of files if you have a system with a lot of memory. Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
| * NFS: Avoid referencing the cred twice in async rename/unlinkTrond Myklebust2020-03-161-2/+2
| | | | | | | | | | | | | | In both async rename and rename, we take a reference to the cred in the call arguments. Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
| * NFSv4: Avoid unnecessary credential references in layoutgetTrond Myklebust2020-03-162-3/+2
| | | | | | | | | | | | Layoutget is just using the credential attached to the open context. Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
| * NFSv4: Avoid referencing the cred unnecessarily during NFSv4 I/OTrond Myklebust2020-03-161-5/+5
| | | | | | | | | | | | | | Avoid unnecessary references to the cred when we have already referenced it through the open context or the open owner. Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
| * NFS: Assume cred is pinned by open context in I/O requestsTrond Myklebust2020-03-162-2/+2
| | | | | | | | | | | | | | In read/write/commit, we should be able to assume that the cred is pinned by the open context. Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
| * NFS: alloc_nfs_open_context() must use the file cred when availableTrond Myklebust2020-03-161-5/+5
| | | | | | | | | | | | | | | | If we're creating a nfs_open_context() for a specific file pointer, we must use the cred assigned to that file. Fixes: a52458b48af1 ("NFS/NFSD/SUNRPC: replace generic creds with 'struct cred'.") Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
| * NFS: Ensure we time out if a delegreturn does not completeTrond Myklebust2020-03-161-1/+2
| | | | | | | | | | | | | | | | | | We can't allow delegreturn to hold up nfs4_evict_inode() forever, since that can cause the memory shrinkers to block. This patch therefore ensures that we eventually time out, and complete the reclaim of the inode. Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
| * NFSv4/pnfs: pnfs_set_layout_stateid() should update the layout credTrond Myklebust2020-03-163-5/+18
| | | | | | | | | | | | | | | | If the cred assigned to the layout that we're updating differs from the one used to retrieve the new layout segment, then we need to update the layout plh_lc_cred field. Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
| * NFSv4: nfs_update_inplace_delegation() should update delegation credTrond Myklebust2020-03-161-1/+19
| | | | | | | | | | | | | | | | If the cred assigned to the delegation that we're updating differs from the one we're updating too, then we need to update that field too. Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
| * NFS: Use the 64-bit server readdir cookies when possibleTrond Myklebust2020-03-161-17/+44
| | | | | | | | | | | | | | | | | | | | | | | | | | When we're running as a 64-bit architecture and are not running in 32-bit compatibility mode, it is better to use the 64-bit readdir cookies that supplied by the server. Doing so improves the accuracy of telldir()/seekdir(), particularly when the directory is changing, for instance, when doing 'rm -rf'. We still fall back to using the 32-bit offsets on 32-bit architectures and when in compatibility mode. Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
* | Merge tag 'nfsd-5.7' of git://git.linux-nfs.org/projects/cel/cel-2.6Linus Torvalds2020-04-041-5/+6
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Pull nfsd updates from Chuck Lever: - Fix EXCHANGE_ID response when NFSD runs in a container - A battery of new static trace points - Socket transports now use bio_vec to send Replies - NFS/RDMA now supports filesystems with no .splice_read method - Favor memcpy() over DMA mapping for small RPC/RDMA Replies - Add pre-requisites for supporting multiple Write chunks - Numerous minor fixes and clean-ups [ Chuck is filling in for Bruce this time while he and his family settle into a new house ] * tag 'nfsd-5.7' of git://git.linux-nfs.org/projects/cel/cel-2.6: (39 commits) svcrdma: Fix leak of transport addresses SUNRPC: Fix a potential buffer overflow in 'svc_print_xprts()' SUNRPC/cache: don't allow invalid entries to be flushed nfsd: fsnotify on rmdir under nfsd/clients/ nfsd4: kill warnings on testing stateids with mismatched clientids nfsd: remove read permission bit for ctl sysctl NFSD: Fix NFS server build errors sunrpc: Add tracing for cache events SUNRPC/cache: Allow garbage collection of invalid cache entries nfsd: export upcalls must not return ESTALE when mountd is down nfsd: Add tracepoints for update of the expkey and export cache entries nfsd: Add tracepoints for exp_find_key() and exp_get_by_name() nfsd: Add tracing to nfsd_set_fh_dentry() nfsd: Don't add locks to closed or closing open stateids SUNRPC: Teach server to use xprt_sock_sendmsg for socket sends SUNRPC: Refactor xs_sendpages() svcrdma: Avoid DMA mapping small RPC Replies svcrdma: Fix double sync of transport header buffer svcrdma: Refactor chunk list encoders SUNRPC: Add encoders for list item discriminators ...
| * | nfsd: export upcalls must not return ESTALE when mountd is downTrond Myklebust2020-03-161-5/+6
| |/ | | | | | | | | | | | | | | | | | | If the rpc.mountd daemon goes down, then that should not cause all exports to start failing with ESTALE errors. Let's explicitly distinguish between the cache upcall cases that need to time out, and those that do not. Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com> Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
* | Merge tag 'selinux-pr-20200330' of ↵Linus Torvalds2020-03-313-38/+38
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/pcmoore/selinux Pull SELinux updates from Paul Moore: "We've got twenty SELinux patches for the v5.7 merge window, the highlights are below: - Deprecate setting /sys/fs/selinux/checkreqprot to 1. This flag was originally created to deal with legacy userspace and the READ_IMPLIES_EXEC personality flag. We changed the default from 1 to 0 back in Linux v4.4 and now we are taking the next step of deprecating it, at some point in the future we will take the final step of rejecting 1. - Allow kernfs symlinks to inherit the SELinux label of the parent directory. In order to preserve backwards compatibility this is protected by the genfs_seclabel_symlinks SELinux policy capability. - Optimize how we store filename transitions in the kernel, resulting in some significant improvements to policy load times. - Do a better job calculating our internal hash table sizes which resulted in additional policy load improvements and likely general SELinux performance improvements as well. - Remove the unused initial SIDs (labels) and improve how we handle initial SIDs. - Enable per-file labeling for the bpf filesystem. - Ensure that we properly label NFS v4.2 filesystems to avoid a temporary unlabeled condition. - Add some missing XFS quota command types to the SELinux quota access controls. - Fix a problem where we were not updating the seq_file position index correctly in selinuxfs. - We consolidate some duplicated code into helper functions. - A number of list to array conversions. - Update Stephen Smalley's email address in MAINTAINERS" * tag 'selinux-pr-20200330' of git://git.kernel.org/pub/scm/linux/kernel/git/pcmoore/selinux: selinux: clean up indentation issue with assignment statement NFS: Ensure security label is set for root inode MAINTAINERS: Update my email address selinux: avtab_init() and cond_policydb_init() return void selinux: clean up error path in policydb_init() selinux: remove unused initial SIDs and improve handling selinux: reduce the use of hard-coded hash sizes selinux: Add xfs quota command types selinux: optimize storage of filename transitions selinux: factor out loop body from filename_trans_read() security: selinux: allow per-file labeling for bpffs selinux: generalize evaluate_cond_node() selinux: convert cond_expr to array selinux: convert cond_av_list to array selinux: convert cond_list to array selinux: sel_avc_get_stat_idx should increase position index selinux: allow kernfs symlinks to inherit parent directory context selinux: simplify evaluate_cond_node() Documentation,selinux: deprecate setting checkreqprot to 1 selinux: move status variables out of selinux_ss