1. 07 Aug, 2010 1 commit
  2. 06 Aug, 2010 5 commits
    • J. Bruce Fields's avatar
      nfsd: don't allow setting maxblksize after svc created · 7fa53cc8
      J. Bruce Fields authored
      It's harmless to set this after the server is created, but also
      ineffective, since the value is only used at the time of
      svc_create_pooled().  So fail the attempt, in keeping with the pattern
      set by write_versions, write_{lease,grace}time and write_recoverydir.
      
      (This could break userspace that tried to write to nfsd/max_block_size
      between setting up sockets and starting the server.  However, such code
      wouldn't have worked anyway, and I don't know of any examples--rpc.nfsd
      in nfs-utils, probably the only user of the interface, doesn't do that.)
      Signed-off-by: default avatarJ. Bruce Fields <bfields@redhat.com>
      7fa53cc8
    • J. Bruce Fields's avatar
      nfsd: initialize nfsd versions before creating svc · e844a7b9
      J. Bruce Fields authored
      Commit 59db4a0c "nfsd: move more into
      nfsd_startup()" inadvertently moved nfsd_versions after
      nfsd_create_svc().  On older distributions using an rpc.nfsd that does
      not explicitly set the list of nfsd versions, this results in
      svc-create_pooled() being called with an empty versions array.  The
      resulting incomplete initialization leads to a NULL dereference in
      svc_process_common() the first time a client accesses the server.
      
      Move nfsd_reset_versions() back before the svc_create_pooled(); this
      time, put it closer to the svc_create_pooled() call, to make this
      mistake more difficult in the future.
      Signed-off-by: default avatarJ. Bruce Fields <bfields@redhat.com>
      e844a7b9
    • Andrea Gelmini's avatar
      e2aa7f83
    • Boaz Harrosh's avatar
      nfsd41: Fix a crash when a callback is retried · c18c821f
      Boaz Harrosh authored
      If a callback is retried at nfsd4_cb_recall_done() due to
      some error, the returned rpc reply crashes here:
      
      @@ -514,6 +514,7 @@ decode_cb_sequence(struct xdr_stream *xdr, struct nfsd4_cb_sequence *res,
       	u32 dummy;
       	__be32 *p;
      
       +	BUG_ON(!res);
       	if (res->cbs_minorversion == 0)
       		return 0;
      
      [BUG_ON added for demonstration]
      
      This is because the nfsd4_cb_done_sequence() has NULLed out
      the task->tk_msg.rpc_resp pointer.
      
      Also eventually the rpc would use the new slot without making
      sure it is free by calling nfsd41_cb_setup_sequence().
      
      This problem was introduced by a 4.1 protocol addition patch:
      	[0421b5c5] nfsd41: Backchannel: Implement cb_recall over NFSv4.1
      
      Which was overlooking the possibility of an RPC callback retries.
      For not-4.1 case redoing the _prepare is harmless.
      Signed-off-by: default avatarBoaz Harrosh <bharrosh@panasas.com>
      Signed-off-by: default avatarJ. Bruce Fields <bfields@redhat.com>
      c18c821f
    • J. Bruce Fields's avatar
      nfsd: fix startup/shutdown order bug · 774f8bbd
      J. Bruce Fields authored
      We must create the server before we can call init_socks or check the
      number of threads.
      
      Symptoms were a NULL pointer dereference in nfsd_svc().  Problem
      identified by Jeff Layton.
      
      Also fix a minor cleanup-on-error case in nfsd_startup().
      Reported-by: default avatarTetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
      Signed-off-by: default avatarJ. Bruce Fields <bfields@redhat.com>
      774f8bbd
  3. 30 Jul, 2010 1 commit
  4. 29 Jul, 2010 5 commits
    • Andi Kleen's avatar
      gcc-4.6: nfsd: fix initialized but not read warnings · 69049961
      Andi Kleen authored
      Fixes at least one real minor bug: the nfs4 recovery dir sysctl
      would not return its status properly.
      
      Also I finished Al's 1e41568d ("Take ima_path_check() in nfsd
      past dentry_open() in nfsd_open()") commit, it moved the IMA
      code, but left the old path initializer in there.
      
      The rest is just dead code removed I think, although I was not
      fully sure about the "is_borc" stuff. Some more review
      would be still good.
      
      Found by gcc 4.6's new warnings.
      Signed-off-by: default avatarAndi Kleen <ak@linux.intel.com>
      Cc: Al Viro <viro@zeniv.linux.org.uk>
      Cc: Neil Brown <neilb@suse.de>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarJ. Bruce Fields <bfields@redhat.com>
      69049961
    • J. Bruce Fields's avatar
      nfsd4: share file descriptors between stateid's · f9d7562f
      J. Bruce Fields authored
      The vfs doesn't really allow us to "upgrade" a file descriptor from
      read-only to read-write, and our attempt to do so in nfs4_upgrade_open
      is ugly and incomplete.
      
      Move to a different scheme where we keep multiple opens, shared between
      open stateid's, in the nfs4_file struct.  Each file will be opened at
      most 3 times (for read, write, and read-write), and those opens will be
      shared between all clients and openers.  On upgrade we will do another
      open if necessary instead of attempting to upgrade an existing open.
      We keep count of the number of readers and writers so we know when to
      close the shared files.
      Signed-off-by: default avatarJ. Bruce Fields <bfields@citi.umich.edu>
      f9d7562f
    • J. Bruce Fields's avatar
      nfsd4: fix openmode checking on IO using lock stateid · 02921914
      J. Bruce Fields authored
      It is legal to perform a write using the lock stateid that was
      originally associated with a read lock, or with a file that was
      originally opened for read, but has since been upgraded.
      
      So, when checking the openmode, check the mode associated with the
      open stateid from which the lock was derived.
      Signed-off-by: default avatarJ. Bruce Fields <bfields@redhat.com>
      02921914
    • J. Bruce Fields's avatar
      nfsd4: miscellaneous process_open2 cleanup · 21fb4016
      J. Bruce Fields authored
      Move more work into helper functions.
      Signed-off-by: default avatarJ. Bruce Fields <bfields@redhat.com>
      21fb4016
    • J. Bruce Fields's avatar
      nfsd4: don't pretend to support write delegations · c3e48080
      J. Bruce Fields authored
      The delegation code mostly pretends to support either read or write
      delegations.  However, correct support for write delegations would
      require, for example, breaking of delegations (and/or implementation of
      cb_getattr) on stat.  Currently all that stops us from handing out
      delegations is a subtle reference-counting issue.
      
      Avoid confusion by adding an earlier check that explicitly refuses write
      delegations.
      
      For now, though, I'm not going so far as to rip out existing
      half-support for write delegations, in case we get around to using that
      soon.
      Signed-off-by: default avatarJ. Bruce Fields <bfields@redhat.com>
      c3e48080
  5. 27 Jul, 2010 1 commit
    • J. Bruce Fields's avatar
      nfsd: bypass readahead cache when have struct file · fa0a2126
      J. Bruce Fields authored
      The readahead cache compensates for the fact that the NFS server
      currently does an open and close on every IO operation in the NFSv2 and
      NFSv3 case.
      
      In the NFSv4 case we have long-lived struct files associated with client
      opens, so there's no need for this.  In fact, concurrent IO's using
      trying to modify the same file->f_ra may cause problems.
      
      So, don't bother with the readahead cache in that case.
      
      Note eventually we'll likely do this in the v2/v3 case as well by
      keeping a cache of struct files instead of struct file_ra_state's.
      Signed-off-by: default avatarJ. Bruce Fields <bfields@redhat.com>
      fa0a2126
  6. 23 Jul, 2010 8 commits
  7. 07 Jul, 2010 1 commit
    • Chuck Lever's avatar
      NFSD: Fill in WCC data for REMOVE, RMDIR, MKNOD, and MKDIR · 43a9aa64
      Chuck Lever authored
      Some well-known NFSv3 clients drop their directory entry caches when
      they receive replies with no WCC data.  Without this data, they
      employ extra READ, LOOKUP, and GETATTR requests to ensure their
      directory entry caches are up to date, causing performance to suffer
      needlessly.
      
      In order to return WCC data, our server has to have both the pre-op
      and the post-op attribute data on hand when a reply is XDR encoded.
      The pre-op data is filled in when the incoming fh is locked, and the
      post-op data is filled in when the fh is unlocked.
      
      Unfortunately, for REMOVE, RMDIR, MKNOD, and MKDIR, the directory fh
      is not unlocked until well after the reply has been XDR encoded.  This
      means that encode_wcc_data() does not have wcc_data for the parent
      directory, so none is returned to the client after these operations
      complete.
      
      By unlocking the parent directory fh immediately after the internal
      operations for each NFS procedure is complete, the post-op data is
      filled in before XDR encoding starts, so it can be returned to the
      client properly.
      Signed-off-by: default avatarChuck Lever <chuck.lever@oracle.com>
      Signed-off-by: default avatarJ. Bruce Fields <bfields@citi.umich.edu>
      43a9aa64
  8. 06 Jul, 2010 2 commits
    • J. Bruce Fields's avatar
      6a85d6c7
    • Artem Bityutskiy's avatar
      sunrpc: make the cache cleaner workqueue deferrable · 8eab945c
      Artem Bityutskiy authored
      This patch makes the cache_cleaner workqueue deferrable, to prevent
      unnecessary system wake-ups, which is very important for embedded
      battery-powered devices.
      
      do_cache_clean() is called every 30 seconds at the moment, and often
      makes the system wake up from its power-save sleep state. With this
      change, when the workqueue uses a deferrable timer, the
      do_cache_clean() invocation will be delayed and combined with the
      closest "real" wake-up. This improves the power consumption situation.
      
      Note, I tried to create a DECLARE_DELAYED_WORK_DEFERRABLE() helper
      macro, similar to DECLARE_DELAYED_WORK(), but failed because of the
      way the timer wheel core stores the deferrable flag (it is the
      LSBit in the time->base pointer). My attempt to define a static
      variable with this bit set ended up with the "initializer element is
      not constant" error.
      
      Thus, I have to use run-time initialization, so I created a new
      cache_initialize() function which is called once when sunrpc is
      being initialized.
      Signed-off-by: default avatarArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
      Signed-off-by: default avatarJ. Bruce Fields <bfields@citi.umich.edu>
      8eab945c
  9. 24 Jun, 2010 2 commits
  10. 23 Jun, 2010 1 commit
  11. 22 Jun, 2010 3 commits
  12. 31 May, 2010 4 commits
  13. 30 May, 2010 6 commits