1. 04 4月, 2018 12 次提交
    • J
      f2fs: remain written times to update inode during fsync · 214c2461
      Jaegeuk Kim 提交于
      This fixes xfstests/generic/392.
      
      The failure was caused by different times between 1) one marked in the last
      fsync(2) call and 2) the other given by roll-forward recovery after power-cut.
      The reason was that we skipped updating inode block at 1), since its i_size
      was recoverable along with 4KB-aligned data writes, which was fixed by:
        "f2fs: fix a wrong condition in f2fs_skip_inode_update"
      Reviewed-by: NChao Yu <yuchao0@huawei.com>
      Signed-off-by: NJaegeuk Kim <jaegeuk@kernel.org>
      214c2461
    • J
      nfsd: fix incorrect umasks · 880a3a53
      J. Bruce Fields 提交于
      We're neglecting to clear the umask after it's set, which can cause a
      later unrelated rpc to (incorrectly) use the same umask if it happens to
      be processed by the same thread.
      
      There's a more subtle problem here too:
      
      An NFSv4 compound request is decoded all in one pass before any
      operations are executed.
      
      Currently we're setting current->fs->umask at the time we decode the
      compound.  In theory a single compound could contain multiple creates
      each setting a umask.  In that case we'd end up using whichever umask
      was passed in the *last* operation as the umask for all the creates,
      whether that was correct or not.
      
      So, we should just be saving the umask at decode time and waiting to set
      it until we actually process the corresponding operation.
      
      In practice it's unlikely any client would do multiple creates in a
      single compound.  And even if it did they'd likely be from the same
      process (hence carry the same umask).  So this is a little academic, but
      we should get it right anyway.
      
      Fixes: 47057abd (nfsd: add support for the umask attribute)
      Cc: stable@vger.kernel.org
      Reported-by: NLucash Stach <l.stach@pengutronix.de>
      Signed-off-by: NJ. Bruce Fields <bfields@redhat.com>
      880a3a53
    • C
      NFSD: Clean up legacy NFS SYMLINK argument XDR decoders · 38a70315
      Chuck Lever 提交于
      Move common code in NFSD's legacy SYMLINK decoders into a helper.
      The immediate benefits include:
      
       - one fewer data copies on transports that support DDP
       - consistent error checking across all versions
       - reduction of code duplication
       - support for both legal forms of SYMLINK requests on RDMA
         transports for all versions of NFS (in particular, NFSv2, for
         completeness)
      
      In the long term, this helper is an appropriate spot to perform a
      per-transport call-out to fill the pathname argument using, say,
      RDMA Reads.
      
      Filling the pathname in the proc function also means that eventually
      the incoming filehandle can be interpreted so that filesystem-
      specific memory can be allocated as a sink for the pathname
      argument, rather than using anonymous pages.
      Signed-off-by: NChuck Lever <chuck.lever@oracle.com>
      Signed-off-by: NJ. Bruce Fields <bfields@redhat.com>
      38a70315
    • C
      NFSD: Clean up legacy NFS WRITE argument XDR decoders · 8154ef27
      Chuck Lever 提交于
      Move common code in NFSD's legacy NFS WRITE decoders into a helper.
      The immediate benefit is reduction of code duplication and some nice
      micro-optimizations (see below).
      
      In the long term, this helper can perform a per-transport call-out
      to fill the rq_vec (say, using RDMA Reads).
      
      The legacy WRITE decoders and procs are changed to work like NFSv4,
      which constructs the rq_vec just before it is about to call
      vfs_writev.
      
      Why? Calling a transport call-out from the proc instead of the XDR
      decoder means that the incoming FH can be resolved to a particular
      filesystem and file. This would allow pages from the backing file to
      be presented to the transport to be filled, rather than presenting
      anonymous pages and copying or flipping them into the file's page
      cache later.
      
      I also prefer using the pages in rq_arg.pages, instead of pulling
      the data pages directly out of the rqstp::rq_pages array. This is
      currently the way the NFSv3 write decoder works, but the other two
      do not seem to take this approach. Fixing this removes the only
      reference to rq_pages found in NFSD, eliminating an NFSD assumption
      about how transports use the pages in rq_pages.
      
      Lastly, avoid setting up the first element of rq_vec as a zero-
      length buffer. This happens with an RDMA transport when a normal
      Read chunk is present because the data payload is in rq_arg's
      page list (none of it is in the head buffer).
      Signed-off-by: NChuck Lever <chuck.lever@oracle.com>
      Signed-off-by: NJ. Bruce Fields <bfields@redhat.com>
      8154ef27
    • C
      nfsd: Trace NFSv4 COMPOUND execution · fff4080b
      Chuck Lever 提交于
      This helps record the identity and timing of the ops in each NFSv4
      COMPOUND, replacing dprintk calls that did much the same thing.
      Signed-off-by: NChuck Lever <chuck.lever@oracle.com>
      Signed-off-by: NJ. Bruce Fields <bfields@redhat.com>
      fff4080b
    • C
      nfsd: Add I/O trace points in the NFSv4 read proc · 87c5942e
      Chuck Lever 提交于
      NFSv4 read compound processing invokes nfsd_splice_read and
      nfs_readv directly, so the trace points currently in nfsd_read are
      not invoked for NFSv4 reads.
      
      Move the NFSD READ trace points to common helpers so that NFSv4
      reads are captured.
      
      Also, record any local I/O error that occurs, the total count of
      bytes that were actually returned, and whether splice or vectored
      read was used.
      Signed-off-by: NChuck Lever <chuck.lever@oracle.com>
      Signed-off-by: NJ. Bruce Fields <bfields@redhat.com>
      87c5942e
    • C
      nfsd: Add I/O trace points in the NFSv4 write path · d890be15
      Chuck Lever 提交于
      NFSv4 write compound processing invokes nfsd_vfs_write directly. The
      trace points currently in nfsd_write are not effective for NFSv4
      writes.
      
      Move the trace points into the shared nfsd_vfs_write() helper.
      
      After the I/O, we also want to record any local I/O error that
      might have occurred, and the total count of bytes that were actually
      moved (rather than the requested number).
      Signed-off-by: NChuck Lever <chuck.lever@oracle.com>
      Signed-off-by: NJ. Bruce Fields <bfields@redhat.com>
      d890be15
    • C
      nfsd: Add "nfsd_" to trace point names · f394b62b
      Chuck Lever 提交于
      Follow naming convention used in client and in sunrpc layers.
      Signed-off-by: NChuck Lever <chuck.lever@oracle.com>
      Signed-off-by: NJ. Bruce Fields <bfields@redhat.com>
      f394b62b
    • C
      nfsd: Record request byte count, not count of vectors · 79e0b4e2
      Chuck Lever 提交于
      Byte count is more helpful to know than vector count.
      Signed-off-by: NChuck Lever <chuck.lever@oracle.com>
      Signed-off-by: NJ. Bruce Fields <bfields@redhat.com>
      79e0b4e2
    • C
      nfsd: Fix NFSD trace points · afa720a0
      Chuck Lever 提交于
      nfsd-1915  [003] 77915.780959: write_opened:
      	[FAILED TO PARSE] xid=3286130958 fh=0 offset=154624 len=1
      nfsd-1915  [003] 77915.780960: write_io_done:
      	[FAILED TO PARSE] xid=3286130958 fh=0 offset=154624 len=1
      nfsd-1915  [003] 77915.780964: write_done:
      	[FAILED TO PARSE] xid=3286130958 fh=0 offset=154624 len=1
      
      Byte swapping and knfsd_fh_hash() are not available in "trace-cmd
      report", where the print format string is actually used. These
      data transformations have to be done during the TP_fast_assign step.
      Signed-off-by: NChuck Lever <chuck.lever@oracle.com>
      Signed-off-by: NJ. Bruce Fields <bfields@redhat.com>
      afa720a0
    • S
      nfsd: use correct enum type in decode_cb_op_status · 47299f79
      Stefan Agner 提交于
      Use enum nfs_cb_opnum4 in decode_cb_op_status. This fixes warnings
      seen with clang:
        fs/nfsd/nfs4callback.c:451:36: warning: implicit conversion from
            enumeration type 'enum nfs_cb_opnum4' to different enumeration
            type 'enum nfs_opnum4' [-Wenum-conversion]
              status = decode_cb_op_status(xdr, OP_CB_SEQUENCE, &cb->cb_seq_status);
                       ~~~~~~~~~~~~~~~~~~~      ^~~~~~~~~~~~~~
      Signed-off-by: NStefan Agner <stefan@agner.ch>
      Signed-off-by: NJ. Bruce Fields <bfields@redhat.com>
      47299f79
    • F
      nfsd: fix boolreturn.cocci warnings · 51d87bc2
      Fengguang Wu 提交于
      fs/nfsd/nfs4state.c:926:8-9: WARNING: return of 0/1 in function 'nfs4_delegation_exists' with return type bool
      fs/nfsd/nfs4state.c:2955:9-10: WARNING: return of 0/1 in function 'nfsd4_compound_in_session' with return type bool
      
       Return statements in functions returning bool should use
       true/false instead of 1/0.
      Generated by: scripts/coccinelle/misc/boolreturn.cocci
      
      Fixes: 68b18f52 ("nfsd: make nfs4_get_existing_delegation less confusing")
      Signed-off-by: NFengguang Wu <fengguang.wu@intel.com>
      Reported-by: NDan Carpenter <dan.carpenter@oracle.com>
      [bfields: also fix -EAGAIN]
      Signed-off-by: NJ. Bruce Fields <bfields@redhat.com>
      51d87bc2
  2. 03 4月, 2018 28 次提交