1. 05 5月, 2015 4 次提交
  2. 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
  3. 16 4月, 2015 2 次提交
  4. 03 4月, 2015 2 次提交
  5. 01 4月, 2015 7 次提交
  6. 31 3月, 2015 1 次提交
  7. 26 3月, 2015 5 次提交
  8. 21 3月, 2015 5 次提交
    • K
      NFSD: Put exports after nfsd4_layout_verify fail · a1420384
      Kinglong Mee 提交于
      Fix commit 9cf514cc (nfsd: implement pNFS operations).
      Signed-off-by: NKinglong Mee <kinglongmee@gmail.com>
      Reviewed-by: NChristoph Hellwig <hch@lst.de>
      Signed-off-by: NJ. Bruce Fields <bfields@redhat.com>
      a1420384
    • K
      NFSD: Error out when register_shrinker() fail · a68465c9
      Kinglong Mee 提交于
      If register_shrinker() failed, nfsd will cause a NULL pointer access as,
      
      [ 9250.875465] nfsd: last server has exited, flushing export cache
      [ 9251.427270] BUG: unable to handle kernel NULL pointer dereference at           (null)
      [ 9251.427393] IP: [<ffffffff8136fc29>] __list_del_entry+0x29/0xd0
      [ 9251.427579] PGD 13e4d067 PUD 13e4c067 PMD 0
      [ 9251.427633] Oops: 0000 [#1] SMP DEBUG_PAGEALLOC
      [ 9251.427706] Modules linked in: ip6t_rpfilter ip6t_REJECT bnep bluetooth xt_conntrack cfg80211 rfkill ebtable_nat ebtable_broute bridge stp llc ebtable_filter ebtables ip6table_nat nf_conntrack_ipv6 nf_defrag_ipv6 nf_nat_ipv6 ip6table_mangle ip6table_security ip6table_raw ip6table_filter ip6_tables iptable_nat nf_conntrack_ipv4 nf_defrag_ipv4 nf_nat_ipv4 nf_nat nf_conntrack iptable_mangle iptable_security iptable_raw btrfs xfs microcode ppdev serio_raw pcspkr xor libcrc32c raid6_pq e1000 parport_pc parport i2c_piix4 i2c_core nfsd(OE-) auth_rpcgss nfs_acl lockd sunrpc(E) ata_generic pata_acpi
      [ 9251.428240] CPU: 0 PID: 1557 Comm: rmmod Tainted: G           OE 3.16.0-rc2+ #22
      [ 9251.428366] Hardware name: VMware, Inc. VMware Virtual Platform/440BX Desktop Reference Platform, BIOS 6.00 07/31/2013
      [ 9251.428496] task: ffff880000849540 ti: ffff8800136f4000 task.ti: ffff8800136f4000
      [ 9251.428593] RIP: 0010:[<ffffffff8136fc29>]  [<ffffffff8136fc29>] __list_del_entry+0x29/0xd0
      [ 9251.428696] RSP: 0018:ffff8800136f7ea0  EFLAGS: 00010207
      [ 9251.428751] RAX: 0000000000000000 RBX: ffffffffa0116d48 RCX: dead000000200200
      [ 9251.428814] RDX: 0000000000000000 RSI: 0000000000000000 RDI: ffffffffa0116d48
      [ 9251.428876] RBP: ffff8800136f7ea0 R08: ffff8800136f4000 R09: 0000000000000001
      [ 9251.428939] R10: 8080808080808080 R11: 0000000000000000 R12: ffffffffa011a5a0
      [ 9251.429002] R13: 0000000000000800 R14: 0000000000000000 R15: 00000000018ac090
      [ 9251.429064] FS:  00007fb9acef0740(0000) GS:ffff88003fa00000(0000) knlGS:0000000000000000
      [ 9251.429164] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      [ 9251.429221] CR2: 0000000000000000 CR3: 0000000031a17000 CR4: 00000000001407f0
      [ 9251.429306] Stack:
      [ 9251.429410]  ffff8800136f7eb8 ffffffff8136fcdd ffffffffa0116d20 ffff8800136f7ed0
      [ 9251.429511]  ffffffff8118a0f2 0000000000000000 ffff8800136f7ee0 ffffffffa00eb765
      [ 9251.429610]  ffff8800136f7ef0 ffffffffa010e93c ffff8800136f7f78 ffffffff81104ac2
      [ 9251.429709] Call Trace:
      [ 9251.429755]  [<ffffffff8136fcdd>] list_del+0xd/0x30
      [ 9251.429896]  [<ffffffff8118a0f2>] unregister_shrinker+0x22/0x40
      [ 9251.430037]  [<ffffffffa00eb765>] nfsd_reply_cache_shutdown+0x15/0x90 [nfsd]
      [ 9251.430106]  [<ffffffffa010e93c>] exit_nfsd+0x9/0x6cd [nfsd]
      [ 9251.430192]  [<ffffffff81104ac2>] SyS_delete_module+0x162/0x200
      [ 9251.430280]  [<ffffffff81013b69>] ? do_notify_resume+0x59/0x90
      [ 9251.430395]  [<ffffffff816f2369>] system_call_fastpath+0x16/0x1b
      [ 9251.430457] Code: 00 00 55 48 8b 17 48 b9 00 01 10 00 00 00 ad de 48 8b 47 08 48 89 e5 48 39 ca 74 29 48 b9 00 02 20 00 00 00 ad de 48 39 c8 74 7a <4c> 8b 00 4c 39 c7 75 53 4c 8b 42 08 4c 39 c7 75 2b 48 89 42 08
      [ 9251.430691] RIP  [<ffffffff8136fc29>] __list_del_entry+0x29/0xd0
      [ 9251.430755]  RSP <ffff8800136f7ea0>
      [ 9251.430805] CR2: 0000000000000000
      [ 9251.431033] ---[ end trace 080f3050d082b4ea ]---
      Signed-off-by: NKinglong Mee <kinglongmee@gmail.com>
      Reviewed-by: NChristoph Hellwig <hch@lst.de>
      Signed-off-by: NJ. Bruce Fields <bfields@redhat.com>
      a68465c9
    • K
      NFSD: Take care the return value from nfsd4_decode_stateid · db59c0ef
      Kinglong Mee 提交于
      Return status after nfsd4_decode_stateid failed.
      Signed-off-by: NKinglong Mee <kinglongmee@gmail.com>
      Reviewed-by: NChristoph Hellwig <hch@lst.de>
      Signed-off-by: NJ. Bruce Fields <bfields@redhat.com>
      db59c0ef
    • K
      NFSD: Check layout type when returning client layouts · 6f8f28ec
      Kinglong Mee 提交于
      According to RFC5661:
      " When lr_returntype is LAYOUTRETURN4_FSID, the current filehandle is used
         to identify the file system and all layouts matching the client ID,
         the fsid of the file system, lora_layout_type, and lora_iomode are
         returned.  When lr_returntype is LAYOUTRETURN4_ALL, all layouts
         matching the client ID, lora_layout_type, and lora_iomode are
         returned and the current filehandle is not used. "
      
      When returning client layouts, always check layout type.
      Signed-off-by: NKinglong Mee <kinglongmee@gmail.com>
      Reviewed-by: NChristoph Hellwig <hch@lst.de>
      Signed-off-by: NJ. Bruce Fields <bfields@redhat.com>
      6f8f28ec
    • K
      NFSD: restore trace event lost in mismerge · 715a03d2
      Kinglong Mee 提交于
      31ef83dc "nfsd: add trace events" had a typo that dropped a trace
      event and replaced it by an incorrect recursive call to
      nfsd4_cb_layout_fail.  133d5582 "Subject: nfsd: don't recursively
      call nfsd4_cb_layout_fail" fixed the crash, this restores the
      tracepoint.
      Reviewed-by: NChristoph Hellwig <hch@lst.de>
      Signed-off-by: NKinglong Mee <kinglongmee@gmail.com>
      Signed-off-by: NJ. Bruce Fields <bfields@redhat.com>
      715a03d2
  9. 20 3月, 2015 1 次提交
    • C
      Subject: nfsd: don't recursively call nfsd4_cb_layout_fail · 133d5582
      Christoph Hellwig 提交于
      Due to a merge error when creating c5c707f9 ("nfsd: implement pNFS
      layout recalls"), we recursively call nfsd4_cb_layout_fail from itself,
      leading to stack overflows.
      Signed-off-by: NChristoph Hellwig <hch@lst.de>
      Fixes:  c5c707f9 ("nfsd: implement pNFS layout recalls")
      Signed-off-by: NJ. Bruce Fields <bfields@redhat.com>
      ---
       fs/nfsd/nfs4layouts.c | 2 --
       1 file changed, 2 deletions(-)
      
      diff --git a/fs/nfsd/nfs4layouts.c b/fs/nfsd/nfs4layouts.c
      index 3c1bfa1..1028a06 100644
      --- a/fs/nfsd/nfs4layouts.c
      +++ b/fs/nfsd/nfs4layouts.c
      @@ -587,8 +587,6 @@ nfsd4_cb_layout_fail(struct nfs4_layout_stateid *ls)
      
       	rpc_ntop((struct sockaddr *)&clp->cl_addr, addr_str, sizeof(addr_str));
      
      -	nfsd4_cb_layout_fail(ls);
      -
       	printk(KERN_WARNING
       		"nfsd: client %s failed to respond to layout recall. "
       		"  Fencing..\n", addr_str);
      --
      1.9.1
      133d5582
  10. 27 2月, 2015 1 次提交
  11. 23 2月, 2015 1 次提交
    • D
      VFS: (Scripted) Convert S_ISLNK/DIR/REG(dentry->d_inode) to d_is_*(dentry) · e36cb0b8
      David Howells 提交于
      Convert the following where appropriate:
      
       (1) S_ISLNK(dentry->d_inode) to d_is_symlink(dentry).
      
       (2) S_ISREG(dentry->d_inode) to d_is_reg(dentry).
      
       (3) S_ISDIR(dentry->d_inode) to d_is_dir(dentry).  This is actually more
           complicated than it appears as some calls should be converted to
           d_can_lookup() instead.  The difference is whether the directory in
           question is a real dir with a ->lookup op or whether it's a fake dir with
           a ->d_automount op.
      
      In some circumstances, we can subsume checks for dentry->d_inode not being
      NULL into this, provided we the code isn't in a filesystem that expects
      d_inode to be NULL if the dirent really *is* negative (ie. if we're going to
      use d_inode() rather than d_backing_inode() to get the inode pointer).
      
      Note that the dentry type field may be set to something other than
      DCACHE_MISS_TYPE when d_inode is NULL in the case of unionmount, where the VFS
      manages the fall-through from a negative dentry to a lower layer.  In such a
      case, the dentry type of the negative union dentry is set to the same as the
      type of the lower dentry.
      
      However, if you know d_inode is not NULL at the call site, then you can use
      the d_is_xxx() functions even in a filesystem.
      
      There is one further complication: a 0,0 chardev dentry may be labelled
      DCACHE_WHITEOUT_TYPE rather than DCACHE_SPECIAL_TYPE.  Strictly, this was
      intended for special directory entry types that don't have attached inodes.
      
      The following perl+coccinelle script was used:
      
      use strict;
      
      my @callers;
      open($fd, 'git grep -l \'S_IS[A-Z].*->d_inode\' |') ||
          die "Can't grep for S_ISDIR and co. callers";
      @callers = <$fd>;
      close($fd);
      unless (@callers) {
          print "No matches\n";
          exit(0);
      }
      
      my @cocci = (
          '@@',
          'expression E;',
          '@@',
          '',
          '- S_ISLNK(E->d_inode->i_mode)',
          '+ d_is_symlink(E)',
          '',
          '@@',
          'expression E;',
          '@@',
          '',
          '- S_ISDIR(E->d_inode->i_mode)',
          '+ d_is_dir(E)',
          '',
          '@@',
          'expression E;',
          '@@',
          '',
          '- S_ISREG(E->d_inode->i_mode)',
          '+ d_is_reg(E)' );
      
      my $coccifile = "tmp.sp.cocci";
      open($fd, ">$coccifile") || die $coccifile;
      print($fd "$_\n") || die $coccifile foreach (@cocci);
      close($fd);
      
      foreach my $file (@callers) {
          chomp $file;
          print "Processing ", $file, "\n";
          system("spatch", "--sp-file", $coccifile, $file, "--in-place", "--no-show-diff") == 0 ||
      	die "spatch failed";
      }
      
      [AV: overlayfs parts skipped]
      Signed-off-by: NDavid Howells <dhowells@redhat.com>
      Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
      e36cb0b8
  12. 17 2月, 2015 1 次提交
  13. 13 2月, 2015 1 次提交
  14. 10 2月, 2015 1 次提交
  15. 05 2月, 2015 1 次提交
    • C
      nfsd: pNFS block layout driver · 8650b8a0
      Christoph Hellwig 提交于
      Add a small shim between core nfsd and filesystems to translate the
      somewhat cumbersome pNFS data structures and semantics to something
      more palatable for Linux filesystems.
      
      Thanks to Rick McNeal for the old prototype pNFS blocklayout server
      code, which gave a lot of inspiration to this version even if no
      code is left from it.
      Signed-off-by: NChristoph Hellwig <hch@lst.de>
      8650b8a0
  16. 03 2月, 2015 2 次提交
    • C
      nfsd: add trace events · 31ef83dc
      Christoph Hellwig 提交于
      For now just a few simple events to trace the layout stateid lifetime, but
      these already were enough to find several bugs in the Linux client layout
      stateid handling.
      Signed-off-by: NChristoph Hellwig <hch@lst.de>
      31ef83dc
    • C
      nfsd: implement pNFS layout recalls · c5c707f9
      Christoph Hellwig 提交于
      Add support to issue layout recalls to clients.  For now we only support
      full-file recalls to get a simple and stable implementation.  This allows
      to embedd a nfsd4_callback structure in the layout_state and thus avoid
      any memory allocations under spinlocks during a recall.  For normal
      use cases that do not intent to share a single file between multiple
      clients this implementation is fully sufficient.
      
      To ensure layouts are recalled on local filesystem access each layout
      state registers a new FL_LAYOUT lease with the kernel file locking code,
      which filesystems that support pNFS exports that require recalls need
      to break on conflicting access patterns.
      
      The XDR code is based on the old pNFS server implementation by
      Andy Adamson, Benny Halevy, Boaz Harrosh, Dean Hildebrand, Fred Isaman,
      Marc Eshel, Mike Sager and Ricardo Labiaga.
      Signed-off-by: NChristoph Hellwig <hch@lst.de>
      c5c707f9