1. 15 5月, 2010 1 次提交
  2. 29 4月, 2010 1 次提交
    • X
      nfs: fix memory leak in nfs_get_sb with CONFIG_NFS_V4 · 9699eda6
      Xiaotian Feng 提交于
      With CONFIG_NFS_V4 and data version 4, nfs_get_sb will allocate memory for
      export_path in nfs4_validate_text_mount_data, so we need to free it then.
      This is addressed in following kmemleak report:
      
      unreferenced object 0xffff88016bf48a50 (size 16):
        comm "mount.nfs", pid 22567, jiffies 4651574704 (age 175471.200s)
        hex dump (first 16 bytes):
          2f 6f 70 74 2f 77 6f 72 6b 00 6b 6b 6b 6b 6b a5  /opt/work.kkkkk.
        backtrace:
          [<ffffffff814b34f9>] kmemleak_alloc+0x60/0xa7
          [<ffffffff81102c76>] kmemleak_alloc_recursive.clone.5+0x1b/0x1d
          [<ffffffff811046b3>] __kmalloc_track_caller+0x18f/0x1b7
          [<ffffffff810e1b08>] kstrndup+0x37/0x54
          [<ffffffffa0336971>] nfs_parse_devname+0x152/0x204 [nfs]
          [<ffffffffa0336af3>] nfs4_validate_text_mount_data+0xd0/0xdc [nfs]
          [<ffffffffa0338deb>] nfs_get_sb+0x325/0x736 [nfs]
          [<ffffffff81113671>] vfs_kern_mount+0xbd/0x17c
          [<ffffffff81113798>] do_kern_mount+0x4d/0xed
          [<ffffffff81129a87>] do_mount+0x787/0x7fe
          [<ffffffff81129b86>] sys_mount+0x88/0xc2
          [<ffffffff81009b42>] system_call_fastpath+0x16/0x1b
      Signed-off-by: NXiaotian Feng <dfeng@redhat.com>
      Cc: Trond Myklebust <Trond.Myklebust@netapp.com>
      Cc: Chuck Lever <chuck.lever@oracle.com>
      Cc: Benny Halevy <bhalevy@panasas.com>
      Cc: Al Viro <viro@ZenIV.linux.org.uk>
      Cc: Andy Adamson <andros@netapp.com>
      Signed-off-by: NTrond Myklebust <Trond.Myklebust@netapp.com>
      9699eda6
  3. 23 4月, 2010 1 次提交
  4. 30 3月, 2010 1 次提交
    • T
      include cleanup: Update gfp.h and slab.h includes to prepare for breaking... · 5a0e3ad6
      Tejun Heo 提交于
      include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h
      
      percpu.h is included by sched.h and module.h and thus ends up being
      included when building most .c files.  percpu.h includes slab.h which
      in turn includes gfp.h making everything defined by the two files
      universally available and complicating inclusion dependencies.
      
      percpu.h -> slab.h dependency is about to be removed.  Prepare for
      this change by updating users of gfp and slab facilities include those
      headers directly instead of assuming availability.  As this conversion
      needs to touch large number of source files, the following script is
      used as the basis of conversion.
      
        http://userweb.kernel.org/~tj/misc/slabh-sweep.py
      
      The script does the followings.
      
      * Scan files for gfp and slab usages and update includes such that
        only the necessary includes are there.  ie. if only gfp is used,
        gfp.h, if slab is used, slab.h.
      
      * When the script inserts a new include, it looks at the include
        blocks and try to put the new include such that its order conforms
        to its surrounding.  It's put in the include block which contains
        core kernel includes, in the same order that the rest are ordered -
        alphabetical, Christmas tree, rev-Xmas-tree or at the end if there
        doesn't seem to be any matching order.
      
      * If the script can't find a place to put a new include (mostly
        because the file doesn't have fitting include block), it prints out
        an error message indicating which .h file needs to be added to the
        file.
      
      The conversion was done in the following steps.
      
      1. The initial automatic conversion of all .c files updated slightly
         over 4000 files, deleting around 700 includes and adding ~480 gfp.h
         and ~3000 slab.h inclusions.  The script emitted errors for ~400
         files.
      
      2. Each error was manually checked.  Some didn't need the inclusion,
         some needed manual addition while adding it to implementation .h or
         embedding .c file was more appropriate for others.  This step added
         inclusions to around 150 files.
      
      3. The script was run again and the output was compared to the edits
         from #2 to make sure no file was left behind.
      
      4. Several build tests were done and a couple of problems were fixed.
         e.g. lib/decompress_*.c used malloc/free() wrappers around slab
         APIs requiring slab.h to be added manually.
      
      5. The script was run on all .h files but without automatically
         editing them as sprinkling gfp.h and slab.h inclusions around .h
         files could easily lead to inclusion dependency hell.  Most gfp.h
         inclusion directives were ignored as stuff from gfp.h was usually
         wildly available and often used in preprocessor macros.  Each
         slab.h inclusion directive was examined and added manually as
         necessary.
      
      6. percpu.h was updated not to include slab.h.
      
      7. Build test were done on the following configurations and failures
         were fixed.  CONFIG_GCOV_KERNEL was turned off for all tests (as my
         distributed build env didn't work with gcov compiles) and a few
         more options had to be turned off depending on archs to make things
         build (like ipr on powerpc/64 which failed due to missing writeq).
      
         * x86 and x86_64 UP and SMP allmodconfig and a custom test config.
         * powerpc and powerpc64 SMP allmodconfig
         * sparc and sparc64 SMP allmodconfig
         * ia64 SMP allmodconfig
         * s390 SMP allmodconfig
         * alpha SMP allmodconfig
         * um on x86_64 SMP allmodconfig
      
      8. percpu.h modifications were reverted so that it could be applied as
         a separate patch and serve as bisection point.
      
      Given the fact that I had only a couple of failures from tests on step
      6, I'm fairly confident about the coverage of this conversion patch.
      If there is a breakage, it's likely to be something in one of the arch
      headers which should be easily discoverable easily on most builds of
      the specific arch.
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Guess-its-ok-by: NChristoph Lameter <cl@linux-foundation.org>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>
      5a0e3ad6
  5. 16 3月, 2010 1 次提交
  6. 03 2月, 2010 1 次提交
  7. 18 12月, 2009 1 次提交
    • L
      Revert "fix mismerge with Trond's stuff (create_mnt_ns() export is gone now)" · a2770d86
      Linus Torvalds 提交于
      This reverts commit e9496ff4. Quoth Al:
      
       "it's dependent on a lot of other stuff not currently in mainline
        and badly broken with current fs/namespace.c.  Sorry, badly
        out-of-order cherry-pick from old queue.
      
        PS: there's a large pending series reworking the refcounting and
        lifetime rules for vfsmounts that will, among other things, allow to
        rip a subtree away _without_ dissolving connections in it, to be
        garbage-collected when all active references are gone.  It's
        considerably saner wrt "is the subtree busy" logics, but it's nowhere
        near being ready for merge at the moment; this changeset is one of the
        things becoming possible with that sucker, but it certainly shouldn't
        have been picked during this cycle.  My apologies..."
      Noticed-by: NEric Paris <eparis@redhat.com>
      Requested-by: NAl Viro <viro@ZenIV.linux.org.uk>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      a2770d86
  8. 17 12月, 2009 1 次提交
  9. 04 12月, 2009 3 次提交
    • C
      NFS: Revert default r/wsize behavior · dd47f96c
      Chuck Lever 提交于
      When the "rsize=" or "wsize=" mount options are not specified,
      text-based mounts have slightly different behavior than legacy binary
      mounts.  Text-based mounts use the smaller of the server's maximum
      and the client's maximum, but binary mounts use the smaller of the
      server's _preferred_ size and the client's maximum.
      
      This difference is actually pretty subtle.  Most servers advertise
      the same value as their maximum and their preferred transfer size, so
      the end result is the same in most cases.
      
      The reason for this difference is that for text-based mounts, if
      r/wsize are not specified, they are set to the largest value supported
      by the client.  For legacy mounts, the values are set to zero if these
      options are not specified.
      
      nfs_server_set_fsinfo() can negotiate the transfer size defaults
      correctly in any case.  There's no need to specify any particular
      value as default in the text-based option parsing logic.
      
      Note that nfs4 doesn't use nfs_server_set_fsinfo(), but the mount.nfs4
      command does set rsize and wsize to 0 if the user didn't specify these
      options.  So, make the same change for text-based NFSv4 mounts.
      
      Thanks to James Pearson <james-p@moving-picture.com> for reporting and
      diagnosing the problem.
      Signed-off-by: NChuck Lever <chuck.lever@oracle.com>
      Signed-off-by: NTrond Myklebust <Trond.Myklebust@netapp.com>
      dd47f96c
    • C
      NFS: Display compressed (shorthand) IPv6 in /proc/mounts · d250e190
      Chuck Lever 提交于
      Recent changes to snprintf() introduced the %pI6c formatter, which can
      display an IPv6 address with standard shorthanding.  Use this new
      formatter when displaying IPv6 server addresses in /proc/mounts.
      Signed-off-by: NChuck Lever <chuck.lever@oracle.com>
      Signed-off-by: NTrond Myklebust <Trond.Myklebust@netapp.com>
      d250e190
    • J
      NFS: convert proto= option to use netids rather than a protoname · ee671b01
      Jeff Layton 提交于
      Solaris uses netids as values for the proto= option, so that when
      someone specifies "tcp6" they get traffic over TCP + IPv6. Until
      recently, this has never really been an issue for Linux since it didn't
      support NFS over IPv6. The netid and the protocol name were generally
      always the same (modulo any strange configuration in /etc/netconfig).
      
      The solaris manpage documents their proto= option as:
      
          proto= _netid_ | rdma
      
      This patch is intended to bring Linux closer to how the Solaris proto=
      option works, by declaring a static netid mapping in the kernel and
      converting the proto= and mountproto= options to follow it and display
      the proper values in /proc/mounts.
      
      Much of this functionality will need to be provided by a userspace
      mount.nfs patch. Chuck Lever has a patch to change mount.nfs in
      the same way. In principle, we could do *all* of this in userspace but
      that would mean that the options in /proc/mounts may not match the
      options used by userspace.
      
      The alternative to the static mapping here is to add a mechanism to
      upcall to userspace for netid's. I'm not opposed to that option, but
      it'll probably mean more overhead (and quite a bit more code). Rather
      than shoot for that at first, I figured it was probably better to
      start simply.
      
      Comments welcome.
      Signed-off-by: NJeff Layton <jlayton@redhat.com>
      Signed-off-by: NTrond Myklebust <Trond.Myklebust@netapp.com>
      ee671b01
  10. 03 12月, 2009 1 次提交
  11. 22 10月, 2009 1 次提交
  12. 13 10月, 2009 1 次提交
  13. 08 10月, 2009 1 次提交
    • T
      NFSv4: Kill nfs4_renewd_prepare_shutdown() · 3050141b
      Trond Myklebust 提交于
      The NFSv4 renew daemon is shared between all active super blocks that refer
      to a particular NFS server, so it is wrong to be shutting it down in
      nfs4_kill_super every time a super block is destroyed.
      
      This patch therefore kills nfs4_renewd_prepare_shutdown altogether, and
      leaves it up to nfs4_shutdown_client() to also shut down the renew daemon
      by means of the existing call to nfs4_kill_renewd().
      Signed-off-by: NTrond Myklebust <Trond.Myklebust@netapp.com>
      3050141b
  14. 07 10月, 2009 3 次提交
  15. 25 9月, 2009 1 次提交
  16. 24 9月, 2009 3 次提交
  17. 21 9月, 2009 1 次提交
  18. 16 9月, 2009 1 次提交
  19. 09 9月, 2009 5 次提交
  20. 24 8月, 2009 1 次提交
    • C
      NFS: Handle a zero-length auth flavor list · 5eecfde6
      Chuck Lever 提交于
      Some releases of Linux rpc.mountd (nfs-utils 1.1.4 and later) return an
      empty auth flavor list if no sec= was specified for the export.  This is
      notably broken server behavior.
      
      The new auth flavor list checking added in a recent commit rejects this
      case.  The OpenSolaris client does too.
      
      The broken mountd implementation is already widely deployed.  To avoid
      a behavioral regression, the kernel's mount client skips flavor checking
      (ie reverts to the pre-2.6.32 behavior) if mountd returns an empty
      flavor list.
      Signed-off-by: NChuck Lever <chuck.lever@oracle.com>
      Signed-off-by: NTrond Myklebust <Trond.Myklebust@netapp.com>
      5eecfde6
  21. 10 8月, 2009 5 次提交
  22. 23 6月, 2009 2 次提交
  23. 18 6月, 2009 3 次提交
    • C
      NFS: More "sloppy" parsing problems · a5a16bae
      Chuck Lever 提交于
      Specifying "port=-5" with the kernel's current mount option parser
      generates "unrecognized mount option".  If "sloppy" is set, this
      causes the mount to succeed and use the default values; the desired
      behavior is that, since this is a valid option with an invalid value,
      the mount should fail, even with "sloppy."
      
      To properly handle "sloppy" parsing, we need to distinguish between
      correct options with invalid values, and incorrect options.  We will
      need to parse integer values by hand, therefore, and not rely on
      match_token().
      
      For instance, these must all fail with "invalid value":
      
      	port=12345678
      	port=-5
      	port=samuel
      
      and not with "unrecognized option," as they do currently.
      
      Thus, for the sake of match_token() we need to treat the values for
      these options as strings, and do the conversion to integers using
      strict_strtol().
      
      This is basically the same solution we used for the earlier "retry="
      fix (commit ecbb3845), except in this case the kernel actually has to
      parse the value, rather than ignore it.
      Signed-off-by: NChuck Lever <chuck.lever@oracle.com>
      Signed-off-by: NTrond Myklebust <Trond.Myklebust@netapp.com>
      a5a16bae
    • C
      NFS: Invalid mount option values should always fail, even with "sloppy" · d23c45fd
      Chuck Lever 提交于
      Ian Kent reports:
      
      "I've noticed a couple of other regressions with the options vers
      and proto option of mount.nfs(8).
      
      The commands:
      
      mount -t nfs -o vers=<invalid version> <server>:/<path> /<mountpoint>
      mount -t nfs -o proto=<invalid proto> <server>:/<path> /<mountpoint>
      
      both immediately fail.
      
      But if the "-s" option is also used they both succeed with the
      mount falling back to defaults (by the look of it).
      
      In the past these failed even when the sloppy option was given, as
      I think they should. I believe the sloppy option is meant to allow
      the mount command to still function for mount options (for example
      in shared autofs maps) that exist on other Unix implementations but
      aren't present in the Linux mount.nfs(8). So, an invalid value
      specified for a known mount option is different to an unknown mount
      option and should fail appropriately."
      
      See RH bugzilla 486266.
      Signed-off-by: NChuck Lever <chuck.lever@oracle.com>
      Signed-off-by: NTrond Myklebust <Trond.Myklebust@netapp.com>
      d23c45fd
    • C
      NFS: Update MNT and MNT3 reply decoding functions · 8e02f6b9
      Chuck Lever 提交于
      Solder xdr_stream-based XDR decoding functions into the in-kernel mountd
      client that are more careful about checking data types and watching for
      buffer overflows.  The new MNT3 decoder includes support for auth-flavor
      list decoding.
      
      The "_sz" macro for MNT3 replies was missing the size of the file handle.
      I've added this back, and included the size of the auth flavor array.
      Signed-off-by: NChuck Lever <chuck.lever@oracle.com>
      Signed-off-by: NTrond Myklebust <Trond.Myklebust@netapp.com>
      8e02f6b9