1. 26 Mar, 2012 10 commits
    • J. Bruce Fields's avatar
      nfsd4: allow numeric idmapping · e9541ce8
      J. Bruce Fields authored
      Mimic the client side by providing a module parameter that turns off
      idmapping in the auth_sys case, for backwards compatibility with NFSv2
      and NFSv3.
      
      Unlike in the client case, we don't have any way to negotiate, since the
      client can return an error to us if it doesn't like the id that we
      return to it in (for example) a getattr call.
      
      However, it has always been possible for servers to return numeric id's,
      and as far as we're aware clients have always been able to handle them.
      
      Also, in the auth_sys case clients already need to have numeric id's the
      same between client and server.
      
      Therefore we believe it's safe to default this to on; but the module
      parameter is available to return to previous behavior if this proves to
      be a problem in some unexpected setup.
      Signed-off-by: default avatarJ. Bruce Fields <bfields@redhat.com>
      e9541ce8
    • Jeff Layton's avatar
      nfsd: don't allow legacy client tracker init for anything but init_net · cc27e0d4
      Jeff Layton authored
      This code isn't set up for containers, so don't allow it to be
      used for anything but init_net.
      Signed-off-by: default avatarJeff Layton <jlayton@redhat.com>
      Signed-off-by: default avatarJ. Bruce Fields <bfields@redhat.com>
      cc27e0d4
    • Jeff Layton's avatar
      nfsd: add notifier to handle mount/unmount of rpc_pipefs sb · 813fd320
      Jeff Layton authored
      In the event that rpc_pipefs isn't mounted when nfsd starts, we
      must register a notifier to handle creating the dentry once it
      is mounted, and to remove the dentry on unmount.
      Signed-off-by: default avatarJeff Layton <jlayton@redhat.com>
      Signed-off-by: default avatarJ. Bruce Fields <bfields@redhat.com>
      813fd320
    • Jeff Layton's avatar
      nfsd: add the infrastructure to handle the cld upcall · f3f80148
      Jeff Layton authored
      ...and add a mechanism for switching between the "legacy" tracker and
      the new one. The decision is made by looking to see whether the
      v4recoverydir exists. If it does, then the legacy client tracker is
      used.
      
      If it's not, then the kernel will create a "cld" pipe in rpc_pipefs.
      That pipe is used to talk to a daemon for handling the upcall.
      
      Most of the data structures for the new client tracker are handled on a
      per-namespace basis, so this upcall should be essentially ready for
      containerization. For now however, nfsd just starts it by calling the
      initialization and exit functions for init_net.
      
      I'm making the assumption that at some point in the future we'll be able
      to determine the net namespace from the nfs4_client. Until then, this
      patch hardcodes init_net in those places. I've sprinkled some "FIXME"
      comments around that code to attempt to make it clear where we'll need
      to fix that up later.
      Signed-off-by: default avatarJeff Layton <jlayton@redhat.com>
      Signed-off-by: default avatarJ. Bruce Fields <bfields@redhat.com>
      f3f80148
    • Jeff Layton's avatar
      nfsd: add a header describing upcall to nfsdcld · 0ab628d8
      Jeff Layton authored
      The daemon takes a versioned binary struct. Hopefully this should allow
      us to revise the struct later if it becomes necessary.
      Signed-off-by: default avatarJeff Layton <jlayton@redhat.com>
      Signed-off-by: default avatarJ. Bruce Fields <bfields@redhat.com>
      0ab628d8
    • Jeff Layton's avatar
      nfsd: add a per-net-namespace struct for nfsd · 7ea34ac1
      Jeff Layton authored
      Eventually, we'll need this when nfsd gets containerized fully. For
      now, create a struct on a per-net-namespace basis that will just hold
      a pointer to the cld_net structure. That struct will hold all of the
      per-net data that we need for the cld tracker.
      
      Eventually we can add other pernet objects to struct nfsd_net.
      Signed-off-by: default avatarJeff Layton <jlayton@redhat.com>
      Signed-off-by: default avatarJ. Bruce Fields <bfields@redhat.com>
      7ea34ac1
    • Jeff Layton's avatar
      sunrpc: create nfsd dir in rpc_pipefs · b3537c35
      Jeff Layton authored
      Add a new top-level dir in rpc_pipefs to hold the pipe for the clientid
      upcall.
      Signed-off-by: default avatarJeff Layton <jlayton@redhat.com>
      Signed-off-by: default avatarJ. Bruce Fields <bfields@redhat.com>
      b3537c35
    • Jeff Layton's avatar
      nfsd: add nfsd4_client_tracking_ops struct and a way to set it · 2a4317c5
      Jeff Layton authored
      Abstract out the mechanism that we use to track clients into a set of
      client name tracking functions.
      
      This gives us a mechanism to plug in a new set of client tracking
      functions without disturbing the callers. It also gives us a way to
      decide on what tracking scheme to use at runtime.
      
      For now, this just looks like pointless abstraction, but later we'll
      add a new alternate scheme for tracking clients on stable storage.
      
      Note too that this patch anticipates the eventual containerization
      of this code by passing in struct net pointers in places. No attempt
      is made to containerize the legacy client tracker however.
      Signed-off-by: default avatarJeff Layton <jlayton@redhat.com>
      Signed-off-by: default avatarJ. Bruce Fields <bfields@redhat.com>
      2a4317c5
    • Jeff Layton's avatar
      nfsd: convert nfs4_client->cl_cb_flags to a generic flags field · a52d726b
      Jeff Layton authored
      We'll need a way to flag the nfs4_client as already being recorded on
      stable storage so that we don't continually upcall. Currently, that's
      recorded in the cl_firststate field of the client struct. Using an
      entire u32 to store a flag is rather wasteful though.
      
      The cl_cb_flags field is only using 2 bits right now, so repurpose that
      to a generic flags field. Rename NFSD4_CLIENT_KILL to
      NFSD4_CLIENT_CB_KILL to make it evident that it's part of the callback
      flags. Add a mask that we can use for existing checks that look to see
      whether any flags are set, so that the new flags don't interfere.
      
      Convert all references to cl_firstate to the NFSD4_CLIENT_STABLE flag,
      and add a new NFSD4_CLIENT_RECLAIM_COMPLETE flag.
      Signed-off-by: default avatarJeff Layton <jlayton@redhat.com>
      Signed-off-by: default avatarJ. Bruce Fields <bfields@redhat.com>
      a52d726b
    • J. Bruce Fields's avatar
      Merge nfs containerization work from Trond's tree · 1df00640
      J. Bruce Fields authored
      The nfs containerization work is a prerequisite for Jeff Layton's reboot
      recovery rework.
      1df00640
  2. 21 Mar, 2012 12 commits
  3. 20 Mar, 2012 6 commits
  4. 19 Mar, 2012 5 commits
  5. 17 Mar, 2012 3 commits
    • Sachin Prabhu's avatar
      Try using machine credentials for RENEW calls · e49a29bd
      Sachin Prabhu authored
      Using user credentials for RENEW calls will fail when the user
      credentials have expired.
      
      To avoid this, try using the machine credentials when making RENEW
      calls. If no machine credentials have been set, fall back to using user
      credentials as before.
      Signed-off-by: default avatarSachin Prabhu <sprabhu@redhat.com>
      Signed-off-by: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
      e49a29bd
    • Trond Myklebust's avatar
      NFSv4.1: Fix a few issues in filelayout_commit_pagelist · 9390f425
      Trond Myklebust authored
      - Fix a race in which NFS_I(inode)->commits_outstanding could potentially
        go to zero (triggering a call to nfs_commit_clear_lock()) before we're
        done sending out all the commit RPC calls.
      
      - If nfs_commitdata_alloc fails, there is no reason why we shouldn't
        try to send off all the commits-to-ds.
      
      - Simplify the error handling.
      
      - Change pnfs_commit_list() to always return either
        PNFS_ATTEMPTED or PNFS_NOT_ATTEMPTED.
      Signed-off-by: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
      Cc: Fred Isaman <iisaman@netapp.com>
      9390f425
    • Trond Myklebust's avatar
      NFSv4.1: Clean ups and bugfixes for the pNFS read/writeback/commit code · 8dd37758
      Trond Myklebust authored
      Move more pnfs-isms out of the generic commit code.
      
      Bugfixes:
      
      - filelayout_scan_commit_lists doesn't need to get/put the lseg.
        In fact since it is run under the inode->i_lock, the lseg_put()
        can deadlock.
      
      - Ensure that we distinguish between what needs to be done for
        commit-to-data server and what needs to be done for commit-to-MDS
        using the new flag PG_COMMIT_TO_DS. Otherwise we may end up calling
        put_lseg() on a bucket for a struct nfs_page that got written
        through the MDS.
      
      - Fix a case where we were using list_del() on an nfs_page->wb_list
        instead of list_del_init().
      
      - filelayout_initiate_commit needs to call filelayout_commit_release
        on error instead of the mds_ops->rpc_release(). Otherwise it won't
        clear the commit lock.
      
      Cleanups:
      
      - Let the files layout manage the commit lists for the pNFS case.
        Don't expose stuff like pnfs_choose_commit_list, and the fact
        that the commit buckets hold references to the layout segment
        in common code.
      
      - Cast out the put_lseg() calls for the struct nfs_read/write_data->lseg
        into the pNFS layer from whence they came.
      
      - Let the pNFS layer manage the NFS_INO_PNFS_COMMIT bit.
      Signed-off-by: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
      Cc: Fred Isaman <iisaman@netapp.com>
      8dd37758
  6. 15 Mar, 2012 1 commit
  7. 14 Mar, 2012 3 commits
    • William Dauchy's avatar
      NFSv4: Rate limit the state manager for lock reclaim warning messages · 96dcadc2
      William Dauchy authored
      Adding rate limit on `Lock reclaim failed` messages since it could fill
      up system logs
      Signed-off-by: default avatarWilliam Dauchy <wdauchy@gmail.com>
      Signed-off-by: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
      96dcadc2
    • Boaz Harrosh's avatar
      pnfs-obj: Uglify objio_segment allocation for the sake of the principle :-( · 5318a29c
      Boaz Harrosh authored
      At some past instance Linus Trovalds wrote:
      > From: Linus Torvalds <torvalds@linux-foundation.org>
      > commit a84a79e4 upstream.
      >
      > The size is always valid, but variable-length arrays generate worse code
      > for no good reason (unless the function happens to be inlined and the
      > compiler sees the length for the simple constant it is).
      >
      > Also, there seems to be some code generation problem on POWER, where
      > Henrik Bakken reports that register r28 can get corrupted under some
      > subtle circumstances (interrupt happening at the wrong time?).  That all
      > indicates some seriously broken compiler issues, but since variable
      > length arrays are bad regardless, there's little point in trying to
      > chase it down.
      >
      > "Just don't do that, then".
      
      Since then any use of "variable length arrays" has become blasphemous.
      Even in perfectly good, beautiful, perfectly safe code like the one
      below where the variable length arrays are only used as a sizeof()
      parameter, for type-safe dynamic structure allocations. GCC is not
      executing any stack allocation code.
      
      I have produced a small file which defines two functions main1(unsigned numdevs)
      and main2(unsigned numdevs). main1 uses code as before with call to malloc
      and main2 uses code as of after this patch. I compiled it as:
      	gcc -O2 -S see_asm.c
      and here is what I get:
      
      <see_asm.s>
      main1:
      .LFB7:
      	.cfi_startproc
      	mov	%edi, %edi
      	leaq	4(%rdi,%rdi), %rdi
      	salq	$3, %rdi
      	jmp	malloc
      	.cfi_endproc
      .LFE7:
      	.size	main1, .-main1
      	.p2align 4,,15
      	.globl	main2
      	.type	main2, @function
      main2:
      .LFB8:
      	.cfi_startproc
      	mov	%edi, %edi
      	addq	$2, %rdi
      	salq	$4, %rdi
      	jmp	malloc
      	.cfi_endproc
      .LFE8:
      	.size	main2, .-main2
      	.section	.text.startup,"ax",@progbits
      	.p2align 4,,15
      </see_asm.s>
      
      *Exact* same code !!!
      
      So please seriously consider not accepting this patch and leave the
      perfectly good code intact.
      
      CC: Linus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: default avatarBoaz Harrosh <bharrosh@panasas.com>
      Signed-off-by: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
      5318a29c
    • Bernd Schubert's avatar
      fs: add new FMODE flags: FMODE_32bithash and FMODE_64bithash · 6a8a13e0
      Bernd Schubert authored
      Those flags are supposed to be set by NFS readdir() to tell ext3/ext4
      to 32bit (NFSv2) or 64bit hash values (offsets) in seekdir().
      Signed-off-by: default avatarBernd Schubert <bernd.schubert@itwm.fraunhofer.de>
      Signed-off-by: default avatar"Theodore Ts'o" <tytso@mit.edu>
      6a8a13e0