1. 23 5月, 2014 3 次提交
    • D
      AFS: Pass an afs_call* to call->async_workfn() instead of a work_struct* · 656f88dd
      David Howells 提交于
      call->async_workfn() can take an afs_call* arg rather than a work_struct* as
      the functions assigned there are now called from afs_async_workfn() which has
      to call container_of() anyway.
      Signed-off-by: NDavid Howells <dhowells@redhat.com>
      Reviewed-by: NNathaniel Wesley Filardo <nwf@cs.jhu.edu>
      Reviewed-by: NTejun Heo <tj@kernel.org>
      656f88dd
    • N
      AFS: Fix kafs module unloading · 150a6b47
      Nathaniel Wesley Filardo 提交于
      At present, it is not possible to successfully unload the kafs module if there
      are outstanding async outgoing calls (those made with afs_make_call()).  This
      appears to be due to the changes introduced by:
      
      	commit 05949945
      	Author: Tejun Heo <tj@kernel.org>
      	Date:   Fri Mar 7 10:24:50 2014 -0500
      	Subject: afs: don't use PREPARE_WORK
      
      which didn't go far enough.  The problem is due to:
      
       (1) The aforementioned commit introduced a separate handler function pointer
           in the call, call->async_workfn, in addition to the original workqueue
           item, call->async_work, for asynchronous operations because workqueues
           subsystem cannot handle the workqueue item pointer being changed whilst
           the item is queued or being processed.
      
       (2) afs_async_workfn() was introduced in that commit to be the callback for
           call->async_work.  Its sole purpose is to run whatever call->async_workfn
           points to.
      
       (3) call->async_workfn is only used from afs_async_workfn(), which is only
           set on async_work by afs_collect_incoming_call() - ie. for incoming
           calls.
      
       (4) call->async_workfn is *not* set by afs_make_call() when outgoing calls are
           made, and call->async_work is set afs_process_async_call() - and not
           afs_async_workfn().
      
       (5) afs_process_async_call() now changes call->async_workfn rather than
           call->async_work to point to afs_delete_async_call() to clean up, but this
           is only effective for incoming calls because call->async_work does not
           point to afs_async_workfn() for outgoing calls.
      
       (6) Because, for incoming calls, call->async_work remains pointing to
           afs_process_async_call() this results in an infinite loop.
      
      Instead, make the workqueue uniformly vector through call->async_workfn, via
      afs_async_workfn() and simply initialise call->async_workfn to point to
      afs_process_async_call() in afs_make_call().
      Signed-off-by: NNathaniel Wesley Filardo <nwf@cs.jhu.edu>
      Signed-off-by: NDavid Howells <dhowells@redhat.com>
      Reviewed-by: NTejun Heo <tj@kernel.org>
      150a6b47
    • N
      AFS: Part of afs_end_call() is identical to code elsewhere, so split it · 6cf12869
      Nathaniel Wesley Filardo 提交于
      Split afs_end_call() into two pieces, one of which is identical to code in
      afs_process_async_call().  Replace the latter with a call to the first part of
      afs_end_call().
      Signed-off-by: NNathaniel Wesley Filardo <nwf@cs.jhu.edu>
      Signed-off-by: NDavid Howells <dhowells@redhat.com>
      6cf12869
  2. 21 5月, 2014 1 次提交
    • D
      AFS: Fix cache manager service handlers · 6c67c7c3
      David Howells 提交于
      Fix the cache manager RPC service handlers.  The afs_send_empty_reply() and
      afs_send_simple_reply() functions:
      
       (a) Kill the call and free up the buffers associated with it if they fail.
      
       (b) Return with call intact if it they succeed.
      
      However, none of the callers actually check the result or clean up if
      successful - and may use the now non-existent data if it fails.
      
      This was detected by Dan Carpenter using a static checker:
      
      	The patch 08e0e7c8: "[AF_RXRPC]: Make the in-kernel AFS
      	filesystem use AF_RXRPC." from Apr 26, 2007, leads to the following
      	static checker warning:
      	"fs/afs/cmservice.c:155 SRXAFSCB_CallBack()
      		 warn: 'call' was already freed."
      Reported-by: NDan Carpenter <dan.carpenter@oracle.com>
      Signed-off-by: NDavid Howells <dhowells@redhat.com>
      6c67c7c3
  3. 07 3月, 2014 1 次提交
    • T
      afs: don't use PREPARE_WORK · 05949945
      Tejun Heo 提交于
      PREPARE_[DELAYED_]WORK() are being phased out.  They have few users
      and a nasty surprise in terms of reentrancy guarantee as workqueue
      considers work items to be different if they don't have the same work
      function.
      
      afs_call->async_work is multiplexed with multiple work functions.
      Introduce afs_async_workfn() which invokes afs_call->async_workfn and
      always use it as the work function and update the users to set the
      ->async_workfn field instead of overriding the work function using
      PREPARE_WORK().
      
      It would probably be best to route this with other related updates
      through the workqueue tree.
      
      Compile tested.
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Cc: David Howells <dhowells@redhat.com>
      Cc: linux-afs@lists.infradead.org
      05949945
  4. 17 3月, 2012 1 次提交
    • A
      afs: Remote abort can cause BUG in rxrpc code · c0173863
      Anton Blanchard 提交于
      When writing files to afs I sometimes hit a BUG:
      
      kernel BUG at fs/afs/rxrpc.c:179!
      
      With a backtrace of:
      
      	afs_free_call
      	afs_make_call
      	afs_fs_store_data
      	afs_vnode_store_data
      	afs_write_back_from_locked_page
      	afs_writepages_region
      	afs_writepages
      
      The cause is:
      
      	ASSERT(skb_queue_empty(&call->rx_queue));
      
      Looking at a tcpdump of the session the abort happens because we
      are exceeding our disk quota:
      
      	rx abort fs reply store-data error diskquota exceeded (32)
      
      So the abort error is valid. We hit the BUG because we haven't
      freed all the resources for the call.
      
      By freeing any skbs in call->rx_queue before calling afs_free_call
      we avoid hitting leaking memory and avoid hitting the BUG.
      Signed-off-by: NAnton Blanchard <anton@samba.org>
      Signed-off-by: NDavid Howells <dhowells@redhat.com>
      Cc: <stable@kernel.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      c0173863
  5. 15 1月, 2011 1 次提交
  6. 11 8月, 2010 1 次提交
  7. 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
  8. 17 10月, 2007 1 次提交
    • A
      fs/afs/: possible cleanups · c1206a2c
      Adrian Bunk 提交于
      This patch contains the following possible cleanups:
      - make the following needlessly global functions static:
        - rxrpc.c: afs_send_pages()
        - vlocation.c: afs_vlocation_queue_for_updates()
        - write.c: afs_writepages_region()
      - make the following needlessly global variables static:
        - mntpt.c: afs_mntpt_expiry_timeout
        - proc.c: afs_vlocation_states[]
        - server.c: afs_server_timeout
        - vlocation.c: afs_vlocation_timeout
        - vlocation.c: afs_vlocation_update_timeout
      - #if 0 the following unused function:
        - cell.c: afs_get_cell_maybe()
      - #if 0 the following unused variables:
        - callback.c: afs_vnode_update_timeout
        - cmservice.c: struct afs_cm_workqueue
      Signed-off-by: NAdrian Bunk <bunk@stusta.de>
      Acked-by: NDavid Howells <dhowells@redhat.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      c1206a2c
  9. 20 7月, 2007 1 次提交
  10. 11 5月, 2007 1 次提交
  11. 10 5月, 2007 1 次提交
    • D
      AFS: implement basic file write support · 31143d5d
      David Howells 提交于
      Implement support for writing to regular AFS files, including:
      
       (1) write
      
       (2) truncate
      
       (3) fsync, fdatasync
      
       (4) chmod, chown, chgrp, utime.
      
      AFS writeback attempts to batch writes into as chunks as large as it can manage
      up to the point that it writes back 65535 pages in one chunk or it meets a
      locked page.
      
      Furthermore, if a page has been written to using a particular key, then should
      another write to that page use some other key, the first write will be flushed
      before the second is allowed to take place.  If the first write fails due to a
      security error, then the page will be scrapped and reread before the second
      write takes place.
      
      If a page is dirty and the callback on it is broken by the server, then the
      dirty data is not discarded (same behaviour as NFS).
      
      Shared-writable mappings are not supported by this patch.
      
      [akpm@linux-foundation.org: fix a bunch of warnings]
      Signed-off-by: NDavid Howells <dhowells@redhat.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      31143d5d
  12. 28 4月, 2007 1 次提交
  13. 27 4月, 2007 3 次提交