1. 13 Aug, 2015 1 commit
  2. 10 Aug, 2015 22 commits
  3. 31 Jul, 2015 1 commit
    • Jeff Layton's avatar
      nfsd: do nfs4_check_fh in nfs4_check_file instead of nfs4_check_olstateid · 8fcd461d
      Jeff Layton authored
      Currently, preprocess_stateid_op calls nfs4_check_olstateid which
      verifies that the open stateid corresponds to the current filehandle in the
      call by calling nfs4_check_fh.
      
      If the stateid is a NFS4_DELEG_STID however, then no such check is done.
      This could cause incorrect enforcement of permissions, because the
      nfsd_permission() call in nfs4_check_file uses current the current
      filehandle, but any subsequent IO operation will use the file descriptor
      in the stateid.
      
      Move the call to nfs4_check_fh into nfs4_check_file instead so that it
      can be done for all stateid types.
      Signed-off-by: default avatarJeff Layton <jeff.layton@primarydata.com>
      Cc: stable@vger.kernel.org
      [bfields: moved fh check to avoid NULL deref in special stateid case]
      Signed-off-by: default avatarJ. Bruce Fields <bfields@redhat.com>
      8fcd461d
  4. 20 Jul, 2015 12 commits
    • Chuck Lever's avatar
      svcrdma: Remove svc_rdma_fastreg() · 31193fe5
      Chuck Lever authored
      Commit 0bf48289 ("svcrdma: refactor marshalling logic") removed
      the last call site for svc_rdma_fastreg().
      Signed-off-by: default avatarChuck Lever <chuck.lever@oracle.com>
      Signed-off-by: default avatarJ. Bruce Fields <bfields@redhat.com>
      31193fe5
    • Chuck Lever's avatar
      svcrdma: Clean up svc_rdma_get_reply_array() · 10dc4512
      Chuck Lever authored
      Kernel coding conventions frown upon having large nontrivial
      functions in header files, and the preference these days is to
      allow the compiler to make inlining decisions if possible.
      
      As these functions are re-homed into a .c file, be sure that
      comparisons with fields in struct rpcrdma_msg are with be32
      constants.
      
      This is a refactoring change; no behavior change is intended.
      Signed-off-by: default avatarChuck Lever <chuck.lever@oracle.com>
      Signed-off-by: default avatarJ. Bruce Fields <bfields@redhat.com>
      10dc4512
    • Chuck Lever's avatar
      svcrdma: Fix send_reply() scatter/gather set-up · 9d11b51c
      Chuck Lever authored
      The Linux NFS server returns garbage in the data payload of inline
      NFS/RDMA READ replies. These are READs of under 1000 bytes or so
      where the client has not provided either a reply chunk or a write
      list.
      
      The NFS server delivers the data payload for an NFS READ reply to
      the transport in an xdr_buf page list. If the NFS client did not
      provide a reply chunk or a write list, send_reply() is supposed to
      set up a separate sge for the page containing the READ data, and
      another sge for XDR padding if needed, then post all of the sges via
      a single SEND Work Request.
      
      The problem is send_reply() does not advance through the xdr_buf
      when setting up scatter/gather entries for SEND WR. It always calls
      dma_map_xdr with xdr_off set to zero. When there's more than one
      sge, dma_map_xdr() sets up the SEND sge's so they all point to the
      xdr_buf's head.
      
      The current Linux NFS/RDMA client always provides a reply chunk or
      a write list when performing an NFS READ over RDMA. Therefore, it
      does not exercise this particular case. The Linux server has never
      had to use more than one extra sge for building RPC/RDMA replies
      with a Linux client.
      
      However, an NFS/RDMA client _is_ allowed to send small NFS READs
      without setting up a write list or reply chunk. The NFS READ reply
      fits entirely within the inline reply buffer in this case. This is
      perhaps a more efficient way of performing NFS READs that the Linux
      NFS/RDMA client may some day adopt.
      
      Fixes: b432e6b3 ('svcrdma: Change DMA mapping logic to . . .')
      BugLink: https://bugzilla.linux-nfs.org/show_bug.cgi?id=285Signed-off-by: default avatarChuck Lever <chuck.lever@oracle.com>
      Signed-off-by: default avatarJ. Bruce Fields <bfields@redhat.com>
      9d11b51c
    • Shirley Ma's avatar
      NFS/RDMA Release resources in svcrdma when device is removed · ff79c74d
      Shirley Ma authored
      When removing underlying RDMA device, the rmmod will hang forever if there
      are any outstanding NFS/RDMA client mounts. The outstanding NFS/RDMA counts
      could also prevent the server from shutting down. Further debugging shows
      that the existing connections are not teared down and resource are not
      released when receiving RDMA_CM_EVENT_DEVICE_REMOVAL event. It seems the
      original code missing svc_xprt_put() in RDMA_CM_EVENT_REMOVAL event handler
      thus svc_xprt_free is never invoked to release the existing connection
      resources.
      
      The patch has been passed removing, adding device back and forth without
      stopping NFS/RDMA service. This will also allow a device to be unplugged
      and swapped out without shutting down NFS service.
      
      BugLink: https://bugzilla.linux-nfs.org/show_bug.cgi?id=252Signed-off-by: default avatarShirley Ma <shirley.ma@oracle.com>
      Reviewed-by: default avatarChuck Lever <chuck.lever@oracle.com>
      Signed-off-by: default avatarJ. Bruce Fields <bfields@redhat.com>
      ff79c74d
    • Kinglong Mee's avatar
      7b8f4586
    • Kinglong Mee's avatar
      nfsd: Remove duplicate define of IDMAP_NAMESZ/IDMAP_TYPE_xx · e446d66d
      Kinglong Mee authored
      Just using the macro defined in nfs_idmap.h.
      Signed-off-by: default avatarKinglong Mee <kinglongmee@gmail.com>
      Signed-off-by: default avatarJ. Bruce Fields <bfields@redhat.com>
      e446d66d
    • Kinglong Mee's avatar
      nfsd: Drop including client's header file nfs_fs.h · faf996a6
      Kinglong Mee authored
      nfs_fs.h is a client's header file.
      
      # ll fs/nfsd/nfs4acl.o fs/nfsd/nfsd.ko
      -rw-r--r--. 1 root root 328248 Jul  3 19:26 fs/nfsd/nfs4acl.o
      -rw-r--r--. 1 root root 7452016 Jul  3 19:26 fs/nfsd/nfsd.ko
      
      After this patch,
      # ll fs/nfsd/nfs4acl.o fs/nfsd/nfsd.ko
      -rw-r--r--. 1 root root 150872 Jul  3 19:15 fs/nfsd/nfs4acl.o
      -rw-r--r--. 1 root root 7273792 Jul  3 19:23 fs/nfsd/nfsd.ko
      Signed-off-by: default avatarKinglong Mee <kinglongmee@gmail.com>
      Signed-off-by: default avatarJ. Bruce Fields <bfields@redhat.com>
      faf996a6
    • Kinglong Mee's avatar
      nfsd: Set lc_size_chg before ops->proc_layoutcommit · d8398fc1
      Kinglong Mee authored
      After proc_layoutcommit success, i_size_read(inode) always >= new_size.
      Just set lc_size_chg before proc_layoutcommit, if proc_layoutcommit
      failed, nfsd will skip the lc_size_chg, so it's no harm.
      Signed-off-by: default avatarKinglong Mee <kinglongmee@gmail.com>
      Signed-off-by: default avatarJ. Bruce Fields <bfields@redhat.com>
      d8398fc1
    • J. Bruce Fields's avatar
      Revert "Documentation: NFS/RDMA: Document separate Kconfig symbols" · 28e51af7
      J. Bruce Fields authored
      This reverts commit 731d5cca.
      
      Commit ffe1f0df ("rpcrdma: Merge svcrdma and xprtrdma modules into
      one") forgot to update the corresponding documentation.
      Reported-by: default avatarValentin Rothberg <valentinrothberg@gmail.com>
      Signed-off-by: default avatarJ. Bruce Fields <bfields@redhat.com>
      28e51af7
    • Kinglong Mee's avatar
      nfsd: Fix a memory leak in nfsd4_list_rec_dir() · 4691b271
      Kinglong Mee authored
      If lookup_one_len() failed, nfsd should free those memory allocated for fname.
      Signed-off-by: default avatarKinglong Mee <kinglongmee@gmail.com>
      Signed-off-by: default avatarJ. Bruce Fields <bfields@redhat.com>
      4691b271
    • Kinglong Mee's avatar
      nfsd: Fix a file leak on nfsd4_layout_setlease failure · 1ca4b88e
      Kinglong Mee authored
      If nfsd4_layout_setlease fails, nfsd will not put ls->ls_file.
      
      Fix commit c5c707f9 "nfsd: implement pNFS layout recalls".
      Signed-off-by: default avatarKinglong Mee <kinglongmee@gmail.com>
      Signed-off-by: default avatarJ. Bruce Fields <bfields@redhat.com>
      1ca4b88e
    • Kinglong Mee's avatar
      nfsd: Drop BUG_ON and ignore SECLABEL on absent filesystem · c2227a39
      Kinglong Mee authored
      On an absent filesystem (one served by another server), we need to be
      able to handle requests for certain attributest (like fs_locations, so
      the client can find out which server does have the filesystem), but
      others we can't.
      
      We forgot to take that into account when adding another attribute
      bitmask work for the SECURITY_LABEL attribute.
      
      There an export entry with the "refer" option can result in:
      
      [   88.414272] kernel BUG at fs/nfsd/nfs4xdr.c:2249!
      [   88.414828] invalid opcode: 0000 [#1] SMP
      [   88.415368] Modules linked in: rpcsec_gss_krb5 nfsv4 dns_resolver nfs fscache nfsd xfs libcrc32c iscsi_tcp libiscsi_tcp libiscsi scsi_transport_iscsi iosf_mbi ppdev btrfs coretemp crct10dif_pclmul crc32_pclmul crc32c_intel xor ghash_clmulni_intel raid6_pq vmw_balloon parport_pc parport i2c_piix4 shpchp vmw_vmci acpi_cpufreq auth_rpcgss nfs_acl lockd grace sunrpc vmwgfx drm_kms_helper ttm drm mptspi mptscsih serio_raw mptbase e1000 scsi_transport_spi ata_generic pata_acpi [last unloaded: nfsd]
      [   88.417827] CPU: 0 PID: 2116 Comm: nfsd Not tainted 4.0.7-300.fc22.x86_64 #1
      [   88.418448] Hardware name: VMware, Inc. VMware Virtual Platform/440BX Desktop Reference Platform, BIOS 6.00 05/20/2014
      [   88.419093] task: ffff880079146d50 ti: ffff8800785d8000 task.ti: ffff8800785d8000
      [   88.419729] RIP: 0010:[<ffffffffa04b3c10>]  [<ffffffffa04b3c10>] nfsd4_encode_fattr+0x820/0x1f00 [nfsd]
      [   88.420376] RSP: 0000:ffff8800785db998  EFLAGS: 00010206
      [   88.421027] RAX: 0000000000000001 RBX: 000000000018091a RCX: ffff88006668b980
      [   88.421676] RDX: 00000000fffef7fc RSI: 0000000000000000 RDI: ffff880078d05000
      [   88.422315] RBP: ffff8800785dbb58 R08: ffff880078d043f8 R09: ffff880078d4a000
      [   88.422968] R10: 0000000000010000 R11: 0000000000000002 R12: 0000000000b0a23a
      [   88.423612] R13: ffff880078d05000 R14: ffff880078683100 R15: ffff88006668b980
      [   88.424295] FS:  0000000000000000(0000) GS:ffff88007c600000(0000) knlGS:0000000000000000
      [   88.424944] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      [   88.425597] CR2: 00007f40bc370f90 CR3: 0000000035af5000 CR4: 00000000001407f0
      [   88.426285] Stack:
      [   88.426921]  ffff8800785dbaa8 ffffffffa049e4af ffff8800785dba08 ffffffff813298f0
      [   88.427585]  ffff880078683300 ffff8800769b0de8 0000089d00000001 0000000087f805e0
      [   88.428228]  ffff880000000000 ffff880079434a00 0000000000000000 ffff88006668b980
      [   88.428877] Call Trace:
      [   88.429527]  [<ffffffffa049e4af>] ? exp_get_by_name+0x7f/0xb0 [nfsd]
      [   88.430168]  [<ffffffff813298f0>] ? inode_doinit_with_dentry+0x210/0x6a0
      [   88.430807]  [<ffffffff8123833e>] ? d_lookup+0x2e/0x60
      [   88.431449]  [<ffffffff81236133>] ? dput+0x33/0x230
      [   88.432097]  [<ffffffff8123f214>] ? mntput+0x24/0x40
      [   88.432719]  [<ffffffff812272b2>] ? path_put+0x22/0x30
      [   88.433340]  [<ffffffffa049ac87>] ? nfsd_cross_mnt+0xb7/0x1c0 [nfsd]
      [   88.433954]  [<ffffffffa04b54e0>] nfsd4_encode_dirent+0x1b0/0x3d0 [nfsd]
      [   88.434601]  [<ffffffffa04b5330>] ? nfsd4_encode_getattr+0x40/0x40 [nfsd]
      [   88.435172]  [<ffffffffa049c991>] nfsd_readdir+0x1c1/0x2a0 [nfsd]
      [   88.435710]  [<ffffffffa049a530>] ? nfsd_direct_splice_actor+0x20/0x20 [nfsd]
      [   88.436447]  [<ffffffffa04abf30>] nfsd4_encode_readdir+0x120/0x220 [nfsd]
      [   88.437011]  [<ffffffffa04b58cd>] nfsd4_encode_operation+0x7d/0x190 [nfsd]
      [   88.437566]  [<ffffffffa04aa6dd>] nfsd4_proc_compound+0x24d/0x6f0 [nfsd]
      [   88.438157]  [<ffffffffa0496103>] nfsd_dispatch+0xc3/0x220 [nfsd]
      [   88.438680]  [<ffffffffa006f0cb>] svc_process_common+0x43b/0x690 [sunrpc]
      [   88.439192]  [<ffffffffa0070493>] svc_process+0x103/0x1b0 [sunrpc]
      [   88.439694]  [<ffffffffa0495a57>] nfsd+0x117/0x190 [nfsd]
      [   88.440194]  [<ffffffffa0495940>] ? nfsd_destroy+0x90/0x90 [nfsd]
      [   88.440697]  [<ffffffff810bb728>] kthread+0xd8/0xf0
      [   88.441260]  [<ffffffff810bb650>] ? kthread_worker_fn+0x180/0x180
      [   88.441762]  [<ffffffff81789e58>] ret_from_fork+0x58/0x90
      [   88.442322]  [<ffffffff810bb650>] ? kthread_worker_fn+0x180/0x180
      [   88.442879] Code: 0f 84 93 05 00 00 83 f8 ea c7 85 a0 fe ff ff 00 00 27 30 0f 84 ba fe ff ff 85 c0 0f 85 a5 fe ff ff e9 e3 f9 ff ff 0f 1f 44 00 00 <0f> 0b 66 0f 1f 44 00 00 be 04 00 00 00 4c 89 ef 4c 89 8d 68 fe
      [   88.444052] RIP  [<ffffffffa04b3c10>] nfsd4_encode_fattr+0x820/0x1f00 [nfsd]
      [   88.444658]  RSP <ffff8800785db998>
      [   88.445232] ---[ end trace 6cb9d0487d94a29f ]---
      Signed-off-by: default avatarKinglong Mee <kinglongmee@gmail.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarJ. Bruce Fields <bfields@redhat.com>
      c2227a39
  5. 19 Jul, 2015 4 commits