27 Dec, 2011

1 commit

  • Bruce Fields notes that commit 778fc546f749 ("locks: fix tracking of
    inprogress lease breaks") introduced a possible error pointer
    dereference on failure to allocate memory. locks_conflict() will
    dereference the passed-in new lease lock structure that may be an error pointer.

    This means an open (without O_NONBLOCK set) on a file with a lease
    applied (generally only done when Samba or nfsd (with v4) is running)
    could crash if a kmalloc() fails.

    So instead of playing games with IS_ERROR() all over the place, just
    check the allocation failure early. That makes the code more
    straightforward, and avoids this possible bad pointer dereference.

    Based-on-patch-by: J. Bruce Fields
    Cc: Al Viro
    Signed-off-by: Linus Torvalds

    Linus Torvalds
     

25 Oct, 2011

1 commit

  • * 'for-3.2' of git://linux-nfs.org/~bfields/linux: (103 commits)
    nfs41: implement DESTROY_CLIENTID operation
    nfsd4: typo logical vs bitwise negate for want_mask
    nfsd4: allow NFS4_SHARE_SIGNAL_DELEG_WHEN_RESRC_AVAIL | NFS4_SHARE_PUSH_DELEG_WHEN_UNCONTENDED
    nfsd4: seq->status_flags may be used unitialized
    nfsd41: use SEQ4_STATUS_BACKCHANNEL_FAULT when cb_sequence is invalid
    nfsd4: implement new 4.1 open reclaim types
    nfsd4: remove unneeded CLAIM_DELEGATE_CUR workaround
    nfsd4: warn on open failure after create
    nfsd4: preallocate open stateid in process_open1()
    nfsd4: do idr preallocation with stateid allocation
    nfsd4: preallocate nfs4_file in process_open1()
    nfsd4: clean up open owners on OPEN failure
    nfsd4: simplify process_open1 logic
    nfsd4: make is_open_owner boolean
    nfsd4: centralize renew_client() calls
    nfsd4: typo logical vs bitwise negate
    nfs: fix bug about IPv6 address scope checking
    nfsd4: more robust ignoring of WANT bits in OPEN
    nfsd4: move name-length checks to xdr
    nfsd4: move access/deny validity checks to xdr code
    ...

    Linus Torvalds
     

28 Sep, 2011

1 commit

  • There are numerous broken references to Documentation files (in other
    Documentation files, in comments, etc.). These broken references are
    caused by typo's in the references, and by renames or removals of the
    Documentation files. Some broken references are simply odd.

    Fix these broken references, sometimes by dropping the irrelevant text
    they were part of.

    Signed-off-by: Paul Bolle
    Signed-off-by: Jiri Kosina

    Paul Bolle
     

21 Sep, 2011

1 commit


20 Aug, 2011

4 commits

  • There's an incorrect comment here. Also clean up the logic: the
    "rdlease" and "wrlease" locals are confusingly named, and don't really
    add anything since we can make a decision as soon as we hit one of these
    cases.

    Signed-off-by: J. Bruce Fields

    J. Bruce Fields
     
  • We currently use a bit in fl_flags to record whether a lease is being
    broken, and set fl_type to the type (RDLCK or UNLCK) that it will
    eventually have. This means that once the lease break starts, we forget
    what the lease's type *used* to be. Breaking a read lease will then
    result in blocking read opens, even though there's no conflict--because
    the lease type is now F_UNLCK and we can no longer tell whether it was
    previously a read or write lease.

    So, instead keep fl_type as the original type (the type which we
    enforce), and keep track of whether we're unlocking or merely
    downgrading by replacing the single FL_INPROGRESS flag by
    FL_UNLOCK_PENDING and FL_DOWNGRADE_PENDING flags.

    To get this right we also need to track separate downgrade and break
    times, to handle the case where a write-leased file gets conflicting
    opens first for read, then later for write.

    (I first considered just eliminating the downgrade behavior
    completely--nfsv4 doesn't need it, and nobody as far as I can tell
    actually uses it currently--but Jeremy Allison tells me that Windows
    oplocks do behave this way, so Samba will probably use this some day.)

    Reviewed-by: Jeff Layton
    Signed-off-by: J. Bruce Fields

    J. Bruce Fields
     
  • F_INPROGRESS isn't exposed to userspace. To me it makes more sense in
    fl_flags....

    Reviewed-by: Jeff Layton
    Signed-off-by: J. Bruce Fields

    J. Bruce Fields
     
  • Use a helper function, to simplify upcoming changes.

    Reviewed-by: Jeff Layton
    Signed-off-by: J. Bruce Fields

    J. Bruce Fields
     

21 Jul, 2011

1 commit

  • Both the filesystem and the lock manager can associate operations with a
    lock. Confusingly, one of them (fl_release_private) actually has the
    same name in both operation structures.

    It would save some confusion to give the lock-manager ops different
    names.

    Signed-off-by: J. Bruce Fields

    J. Bruce Fields
     

16 Jul, 2011

1 commit

  • From: Miklos Szeredi

    Remove SLAB initialization entirely, as suggested by Bruce and Linus.
    Allocate with __GFP_ZERO instead and only initialize list heads.

    Signed-off-by: Miklos Szeredi
    Signed-off-by: J. Bruce Fields

    Miklos Szeredi
     

07 Jul, 2011

1 commit

  • locks_alloc_lock() assumed that the allocated struct file_lock is
    already initialized to zero members. This is only true for the first
    allocation of the structure, after reuse some of the members will have
    random values.

    This will for example result in passing random fl_start values to
    userspace in fuse for FL_FLOCK locks, which is an information leak at
    best.

    Fix by reinitializing those members which may be non-zero after freeing.

    Signed-off-by: Miklos Szeredi
    CC: stable@kernel.org
    Signed-off-by: Linus Torvalds

    Miklos Szeredi
     

24 Mar, 2011

1 commit

  • * 'for-2.6.39' of git://linux-nfs.org/~bfields/linux:
    SUNRPC: Remove resource leak in svc_rdma_send_error()
    nfsd: wrong index used in inner loop
    nfsd4: fix comment and remove unused nfsd4_file fields
    nfs41: make sure nfs server return right ca_maxresponsesize_cached
    nfsd: fix compile error
    svcrpc: fix bad argument in unix_domain_find
    nfsd4: fix struct file leak
    nfsd4: minor nfs4state.c reshuffling
    svcrpc: fix rare race on unix_domain creation
    nfsd41: modify the members value of nfsd4_op_flags
    nfsd: add proc file listing kernel's gss_krb5 enctypes
    gss:krb5 only include enctype numbers in gm_upcall_enctypes
    NFSD, VFS: Remove dead code in nfsd_rename()
    nfsd: kill unused macro definition
    locks: use assign_type()

    Linus Torvalds
     

08 Mar, 2011

1 commit


05 Mar, 2011

1 commit


15 Jan, 2011

1 commit

  • * 'for-2.6.38' of git://linux-nfs.org/~bfields/linux: (62 commits)
    nfsd4: fix callback restarting
    nfsd: break lease on unlink, link, and rename
    nfsd4: break lease on nfsd setattr
    nfsd: don't support msnfs export option
    nfsd4: initialize cb_per_client
    nfsd4: allow restarting callbacks
    nfsd4: simplify nfsd4_cb_prepare
    nfsd4: give out delegations more quickly in 4.1 case
    nfsd4: add helper function to run callbacks
    nfsd4: make sure sequence flags are set after destroy_session
    nfsd4: re-probe callback on connection loss
    nfsd4: set sequence flag when backchannel is down
    nfsd4: keep finer-grained callback status
    rpc: allow xprt_class->setup to return a preexisting xprt
    rpc: keep backchannel xprt as long as server connection
    rpc: move sk_bc_xprt to svc_xprt
    nfsd4: allow backchannel recovery
    nfsd4: support BIND_CONN_TO_SESSION
    nfsd4: modify session list under cl_lock
    Documentation: fl_mylease no longer exists
    ...

    Fix up conflicts in fs/nfsd/vfs.c with the vfs-scale work. The
    vfs-scale work touched some msnfs cases, and this merge removes support
    for that entirely, so the conflict was trivial to resolve.

    Linus Torvalds
     

07 Jan, 2011

1 commit

  • Make d_count non-atomic and protect it with d_lock. This allows us to ensure a
    0 refcount dentry remains 0 without dcache_lock. It is also fairly natural when
    we start protecting many other dentry members with d_lock.

    Signed-off-by: Nick Piggin

    Nick Piggin
     

05 Jan, 2011

2 commits


18 Nov, 2010

1 commit


11 Nov, 2010

2 commits

  • A minor oversight from f7347ce4ee7c65415f84be915c018473e7076f31,
    "fasync: re-organize fasync entry insertion to allow it under a
    spinlock": this cleanup-on-error was only needed to handle -ENOMEM. Now
    that we're preallocating it's unneeded.

    Signed-off-by: J. Bruce Fields

    J. Bruce Fields
     
  • We must also free the passed-in lease in the case it wasn't used because
    an existing lease was upgrade/downgraded or already existed.

    Note the nfsd caller doesn't care because it's fl_change callback
    returns an error in those cases.

    Signed-off-by: J. Bruce Fields

    J. Bruce Fields
     

31 Oct, 2010

5 commits


28 Oct, 2010

4 commits

  • * 'flock' of git://git.kernel.org/pub/scm/linux/kernel/git/arnd/bkl:
    locks: turn lock_flocks into a spinlock
    fasync: re-organize fasync entry insertion to allow it under a spinlock
    locks/nfsd: allocate file lock outside of spinlock
    lockd: fix nlmsvc_notify_blocked locking
    lockd: push lock_flocks down

    Linus Torvalds
     
  • Nothing depends on lock_flocks using the BKL
    any more, so we can do the switch over to
    a private spinlock.

    Signed-off-by: Arnd Bergmann

    Arnd Bergmann
     
  • You currently cannot use "fasync_helper()" in an atomic environment to
    insert a new fasync entry, because it will need to allocate the new
    "struct fasync_struct".

    Yet fcntl_setlease() wants to call this under lock_flocks(), which is in
    the process of being converted from the BKL to a spinlock.

    In order to fix this, this abstracts out the actual fasync list
    insertion and the fasync allocations into functions of their own, and
    teaches fs/locks.c to pre-allocate the fasync_struct entry. That way
    the actual list insertion can happen while holding the required
    spinlock.

    Signed-off-by: Linus Torvalds
    [bfields@redhat.com: rebase on top of my changes to Arnd's patch]
    Tested-by: J. Bruce Fields
    Signed-off-by: Arnd Bergmann

    Linus Torvalds
     
  • As suggested by Christoph Hellwig, this moves allocation
    of new file locks out of generic_setlease into the
    callers, nfs4_open_delegation and fcntl_setlease in order
    to allow GFP_KERNEL allocations when lock_flocks has
    become a spinlock.

    Signed-off-by: Arnd Bergmann
    Acked-by: J. Bruce Fields

    Arnd Bergmann
     

27 Oct, 2010

1 commit

  • The lock number in /proc/locks (first field) is implemented by a counter
    (private field of struct seq_file) which is incremented at each call of
    locks_show() and reset to 1 in locks_start() whatever the offset is. It
    should be reset according to the actual position in the list. Because of
    this, the numbering erratically restarts at 1 several times when reading a
    long /proc/locks file.

    Moreover, locks_show() can be called twice to print a single line thus
    skipping a number. The counter should be incremented in locks_next().

    And last, pos is a loff_t, which can be bigger than a pointer, so we don't
    use the pointer as an integer anymore, and allocate a loff_t instead.

    Signed-off-by: Jerome Marchand
    Cc: Pavel Emelyanov
    Cc: Matthew Wilcox
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jerome Marchand
     

05 Oct, 2010

1 commit

  • This prepares the removal of the big kernel lock from the
    file locking code. We still use the BKL as long as fs/lockd
    uses it and ceph might sleep, but we can flip the definition
    to a private spinlock as soon as that's done.
    All users outside of fs/lockd get converted to use
    lock_flocks() instead of lock_kernel() where appropriate.

    Based on an earlier patch to use a spinlock from Matthew
    Wilcox, who has attempted this a few times before, the
    earliest patch from over 10 years ago turned it into
    a semaphore, which ended up being slower than the BKL
    and was subsequently reverted.

    Someone should do some serious performance testing when
    this becomes a spinlock, since this has caused problems
    before. Using a spinlock should be at least as good
    as the BKL in theory, but who knows...

    Signed-off-by: Arnd Bergmann
    Acked-by: Matthew Wilcox
    Cc: Christoph Hellwig
    Cc: Trond Myklebust
    Cc: "J. Bruce Fields"
    Cc: Andrew Morton
    Cc: Miklos Szeredi
    Cc: Frederic Weisbecker
    Cc: Ingo Molnar
    Cc: John Kacur
    Cc: Sage Weil
    Cc: linux-kernel@vger.kernel.org
    Cc: linux-fsdevel@vger.kernel.org

    Arnd Bergmann
     

08 Mar, 2010

1 commit


04 Mar, 2010

1 commit


05 Feb, 2010

1 commit


22 Sep, 2009

1 commit


12 Sep, 2009

1 commit

  • …/git/tip/linux-2.6-tip

    * 'sched-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip: (64 commits)
    sched: Fix sched::sched_stat_wait tracepoint field
    sched: Disable NEW_FAIR_SLEEPERS for now
    sched: Keep kthreads at default priority
    sched: Re-tune the scheduler latency defaults to decrease worst-case latencies
    sched: Turn off child_runs_first
    sched: Ensure that a child can't gain time over it's parent after fork()
    sched: enable SD_WAKE_IDLE
    sched: Deal with low-load in wake_affine()
    sched: Remove short cut from select_task_rq_fair()
    sched: Turn on SD_BALANCE_NEWIDLE
    sched: Clean up topology.h
    sched: Fix dynamic power-balancing crash
    sched: Remove reciprocal for cpu_power
    sched: Try to deal with low capacity, fix update_sd_power_savings_stats()
    sched: Try to deal with low capacity
    sched: Scale down cpu_power due to RT tasks
    sched: Implement dynamic cpu_power
    sched: Add smt_gain
    sched: Update the cpu_power sum during load-balance
    sched: Add SD_PREFER_SIBLING
    ...

    Linus Torvalds
     

18 Jul, 2009

1 commit

  • fs/locks.c:flock_lock_file() is the only user of
    cond_resched_bkl()

    This helper doesn't do anything more than cond_resched(). The
    latter naming is enough to explain that we are rescheduling if
    needed.

    The bkl suffix suggests another semantics but it's actually a
    synonym of cond_resched().

    Reported-by: Peter Zijlstra
    Signed-off-by: Frederic Weisbecker
    Signed-off-by: Peter Zijlstra
    LKML-Reference:
    Signed-off-by: Ingo Molnar

    Frederic Weisbecker
     

17 Jul, 2009

1 commit


25 Apr, 2009

1 commit

  • For every lock request lockd creates a new file_lock object
    in nlmsvc_setgrantargs() by copying the passed in file_lock with
    locks_copy_lock(). A filesystem can attach it's own lock_operations
    vector to the file_lock. It has to be cleaned up at the end of the
    file_lock's life. However, lockd doesn't do it today, yet it
    asserts in nlmclnt_release_lockargs() that the per-filesystem
    state is clean.
    This patch fixes it by exporting locks_release_private() and adding
    it to nlmsvc_freegrantargs(), to be symmetrical to creating a
    file_lock in nlmsvc_setgrantargs().

    Signed-off-by: Felix Blyakher
    Signed-off-by: J. Bruce Fields

    Felix Blyakher