1. 21 7月, 2015 7 次提交
    • K
      nfsd: Add macro NFS_ACL_MASK for ACL · 7b8f4586
      Kinglong Mee 提交于
      Signed-off-by: NKinglong Mee <kinglongmee@gmail.com>
      Signed-off-by: NJ. Bruce Fields <bfields@redhat.com>
      7b8f4586
    • K
      nfsd: Remove duplicate define of IDMAP_NAMESZ/IDMAP_TYPE_xx · e446d66d
      Kinglong Mee 提交于
      Just using the macro defined in nfs_idmap.h.
      Signed-off-by: NKinglong Mee <kinglongmee@gmail.com>
      Signed-off-by: NJ. Bruce Fields <bfields@redhat.com>
      e446d66d
    • K
      nfsd: Drop including client's header file nfs_fs.h · faf996a6
      Kinglong Mee 提交于
      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: NKinglong Mee <kinglongmee@gmail.com>
      Signed-off-by: NJ. Bruce Fields <bfields@redhat.com>
      faf996a6
    • K
      nfsd: Set lc_size_chg before ops->proc_layoutcommit · d8398fc1
      Kinglong Mee 提交于
      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: NKinglong Mee <kinglongmee@gmail.com>
      Signed-off-by: NJ. Bruce Fields <bfields@redhat.com>
      d8398fc1
    • K
      nfsd: Fix a memory leak in nfsd4_list_rec_dir() · 4691b271
      Kinglong Mee 提交于
      If lookup_one_len() failed, nfsd should free those memory allocated for fname.
      Signed-off-by: NKinglong Mee <kinglongmee@gmail.com>
      Signed-off-by: NJ. Bruce Fields <bfields@redhat.com>
      4691b271
    • K
      nfsd: Fix a file leak on nfsd4_layout_setlease failure · 1ca4b88e
      Kinglong Mee 提交于
      If nfsd4_layout_setlease fails, nfsd will not put ls->ls_file.
      
      Fix commit c5c707f9 "nfsd: implement pNFS layout recalls".
      Signed-off-by: NKinglong Mee <kinglongmee@gmail.com>
      Signed-off-by: NJ. Bruce Fields <bfields@redhat.com>
      1ca4b88e
    • K
      nfsd: Drop BUG_ON and ignore SECLABEL on absent filesystem · c2227a39
      Kinglong Mee 提交于
      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: NKinglong Mee <kinglongmee@gmail.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: NJ. Bruce Fields <bfields@redhat.com>
      c2227a39
  2. 23 6月, 2015 3 次提交
  3. 20 6月, 2015 3 次提交
  4. 05 6月, 2015 2 次提交
    • K
      nfsd: Update callback sequnce id only CB_SEQUENCE success · 276f03e3
      Kinglong Mee 提交于
      When testing pnfs layout, nfsd got error NFS4ERR_SEQ_MISORDERED.
      It is caused by nfs return NFS4ERR_DELAY before validate_seqid(),
      don't update the sequnce id, but nfsd updates the sequnce id !!!
      
      According to RFC5661 20.9.3,
      " If CB_SEQUENCE returns an error, then the state of the slot
      (sequence ID, cached reply) MUST NOT change. "
      Signed-off-by: NKinglong Mee <kinglongmee@gmail.com>
      Signed-off-by: NJ. Bruce Fields <bfields@redhat.com>
      276f03e3
    • K
      nfsd: Reset cb_status in nfsd4_cb_prepare() at retrying · 4399396e
      Kinglong Mee 提交于
      nfsd enters a infinite loop and prints message every 10 seconds:
      
      May 31 18:33:52 test-server kernel: Error sending entire callback!
      May 31 18:34:01 test-server kernel: Error sending entire callback!
      
      This is caused by a cb_layoutreturn getting error -10008
      (NFS4ERR_DELAY), the client crashing, and then nfsd entering the
      infinite loop:
      
        bc_sendto --> call_timeout --> nfsd4_cb_done --> nfsd4_cb_layout_done
        with error -10008 --> rpc_delay(task, HZ/100) --> bc_sendto ...
      
      Reproduced using xfstests 074 with nfs client's kdump on,
      CONFIG_DEFAULT_HUNG_TASK_TIMEOUT set, and client's blkmapd down:
      
      1. nfs client's write operation will get the layout of file,
         and then send getdeviceinfo,
      2. but layout segment is not recorded by client because blkmapd is down,
      3. client writes data by sending WRITE to server,
      4. nfs server recalls the layout of the file before WRITE,
      5. network error causes the client reset the session and return NFS4ERR_DELAY,
      6. so client's WRITE operation is waiting the reply.
         If the task hangs 120s, the client will crash.
      7. so that, the next bc_sendto will fail with TIMEOUT,
         and cb_status is NFS4ERR_DELAY.
      Signed-off-by: NKinglong Mee <kinglongmee@gmail.com>
      Signed-off-by: NJ. Bruce Fields <bfields@redhat.com>
      4399396e
  5. 29 5月, 2015 4 次提交
  6. 07 5月, 2015 1 次提交
  7. 05 5月, 2015 7 次提交
  8. 22 4月, 2015 5 次提交
    • G
      nfsd: fix nsfd startup race triggering BUG_ON · bb7ffbf2
      Giuseppe Cantavenera 提交于
      nfsd triggered a BUG_ON in net_generic(...) when rpc_pipefs_event(...)
      in fs/nfsd/nfs4recover.c was called before assigning ntfsd_net_id.
      The following was observed on a MIPS 32-core processor:
      kernel: Call Trace:
      kernel: [<ffffffffc00bc5e4>] rpc_pipefs_event+0x7c/0x158 [nfsd]
      kernel: [<ffffffff8017a2a0>] notifier_call_chain+0x70/0xb8
      kernel: [<ffffffff8017a4e4>] __blocking_notifier_call_chain+0x4c/0x70
      kernel: [<ffffffff8053aff8>] rpc_fill_super+0xf8/0x1a0
      kernel: [<ffffffff8022204c>] mount_ns+0xb4/0xf0
      kernel: [<ffffffff80222b48>] mount_fs+0x50/0x1f8
      kernel: [<ffffffff8023dc00>] vfs_kern_mount+0x58/0xf0
      kernel: [<ffffffff802404ac>] do_mount+0x27c/0xa28
      kernel: [<ffffffff80240cf0>] SyS_mount+0x98/0xe8
      kernel: [<ffffffff80135d24>] handle_sys64+0x44/0x68
      kernel:
      kernel:
              Code: 0040f809  00000000  2e020001 <00020336> 3c12c00d
                      3c02801a  de100000 6442eb98  0040f809
      kernel: ---[ end trace 7471374335809536 ]---
      
      Fixed this behaviour by calling register_pernet_subsys(&nfsd_net_ops) before
      registering rpc_pipefs_event(...) with the notifier chain.
      Signed-off-by: NGiuseppe Cantavenera <giuseppe.cantavenera.ext@nokia.com>
      Signed-off-by: NLorenzo Restelli <lorenzo.restelli.ext@nokia.com>
      Reviewed-by: NKinlong Mee <kinglongmee@gmail.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: NJ. Bruce Fields <bfields@redhat.com>
      bb7ffbf2
    • M
      nfsd: eliminate NFSD_DEBUG · 135dd002
      Mark Salter 提交于
      Commit f895b252 ("sunrpc: eliminate RPC_DEBUG") introduced
      use of IS_ENABLED() in a uapi header which leads to a build
      failure for userspace apps trying to use <linux/nfsd/debug.h>:
      
         linux/nfsd/debug.h:18:15: error: missing binary operator before token "("
        #if IS_ENABLED(CONFIG_SUNRPC_DEBUG)
                      ^
      
      Since this was only used to define NFSD_DEBUG if CONFIG_SUNRPC_DEBUG
      is enabled, replace instances of NFSD_DEBUG with CONFIG_SUNRPC_DEBUG.
      
      Cc: stable@vger.kernel.org
      Fixes: f895b252 "sunrpc: eliminate RPC_DEBUG"
      Signed-off-by: NMark Salter <msalter@redhat.com>
      Reviewed-by: NJeff Layton <jlayton@primarydata.com>
      Signed-off-by: NJ. Bruce Fields <bfields@redhat.com>
      135dd002
    • J
      nfsd4: fix READ permission checking · 6e4891dc
      J. Bruce Fields 提交于
      In the case we already have a struct file (derived from a stateid), we
      still need to do permission-checking; otherwise an unauthorized user
      could gain access to a file by sniffing or guessing somebody else's
      stateid.
      
      Cc: stable@vger.kernel.org
      Fixes: dc97618d "nfsd4: separate splice and readv cases"
      Signed-off-by: NJ. Bruce Fields <bfields@redhat.com>
      6e4891dc
    • J
      nfsd4: disallow SEEK with special stateids · 980608fb
      J. Bruce Fields 提交于
      If the client uses a special stateid then we'll pass a NULL file to
      vfs_llseek.
      
      Fixes: 24bab491 " NFSD: Implement SEEK"
      Cc: Anna Schumaker <Anna.Schumaker@Netapp.com>
      Cc: stable@vger.kernel.org
      Reported-by: NChristoph Hellwig <hch@infradead.org>
      Signed-off-by: NJ. Bruce Fields <bfields@redhat.com>
      980608fb
    • J
      nfsd4: disallow ALLOCATE with special stateids · 5ba4a25a
      J. Bruce Fields 提交于
      vfs_fallocate will hit a NULL dereference if the client tries an
      ALLOCATE or DEALLOCATE with a special stateid.  Fix that.  (We also
      depend on the open to have broken any conflicting leases or delegations
      for us.)
      
      (If it turns out we need to allow special stateid's then we could do a
      temporary open here in the special-stateid case, as we do for read and
      write.  For now I'm assuming it's not necessary.)
      
      Fixes: 95d871f0 "nfsd: Add ALLOCATE support"
      Cc: stable@vger.kernel.org
      Cc: Anna Schumaker <Anna.Schumaker@Netapp.com>
      Signed-off-by: NJ. Bruce Fields <bfields@redhat.com>
      5ba4a25a
  9. 16 4月, 2015 2 次提交
  10. 03 4月, 2015 2 次提交
  11. 01 4月, 2015 4 次提交