23 Feb, 2013

1 commit


10 Oct, 2012

1 commit

  • This is to complete part of the Userspace API (UAPI) disintegration for which
    the preparatory patches were pulled recently. After these patches, userspace
    headers will be segregated into:

    include/uapi/linux/.../foo.h

    for the userspace interface stuff, and:

    include/linux/.../foo.h

    for the strictly kernel internal stuff.

    Signed-off-by: J. Bruce Fields

    J. Bruce Fields
     

27 Sep, 2012

1 commit


21 Aug, 2012

1 commit

  • The rules for fl_type are rather convoluted. Typically it's treated as
    holding specific values, except in the case of LOCK_MAND, in which case
    it can be or'ed with LOCK_READ|LOCK_WRITE.

    On some arches F_WRLCK == 2 and F_UNLCK == 3, so and'ing with F_WRLCK will also
    catch the F_UNLCK case. It's unlikely in either case here that we'd ever see
    F_UNLCK since those shouldn't end up on any lists, but it's still best to be
    consistent.

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

    Jeff Layton
     

02 Aug, 2012

1 commit

  • In commit 3b6e2723f32d ("locks: prevent side-effects of
    locks_release_private before file_lock is initialized") we removed the
    last user of lm_release_private without removing the field itself.

    Signed-off-by: J. Bruce Fields
    Signed-off-by: Linus Torvalds

    J. Bruce Fields
     

01 Aug, 2012

1 commit

  • Pull nfsd changes from J. Bruce Fields:
    "This has been an unusually quiet cycle--mostly bugfixes and cleanup.
    The one large piece is Stanislav's work to containerize the server's
    grace period--but that in itself is just one more step in a
    not-yet-complete project to allow fully containerized nfs service.

    There are a number of outstanding delegation, container, v4 state, and
    gss patches that aren't quite ready yet; 3.7 may be wilder."

    * 'nfsd-next' of git://linux-nfs.org/~bfields/linux: (35 commits)
    NFSd: make boot_time variable per network namespace
    NFSd: make grace end flag per network namespace
    Lockd: move grace period management from lockd() to per-net functions
    LockD: pass actual network namespace to grace period management functions
    LockD: manage grace list per network namespace
    SUNRPC: service request network namespace helper introduced
    NFSd: make nfsd4_manager allocated per network namespace context.
    LockD: make lockd manager allocated per network namespace
    LockD: manage grace period per network namespace
    Lockd: add more debug to host shutdown functions
    Lockd: host complaining function introduced
    LockD: manage used host count per networks namespace
    LockD: manage garbage collection timeout per networks namespace
    LockD: make garbage collector network namespace aware.
    LockD: mark host per network namespace on garbage collect
    nfsd4: fix missing fault_inject.h include
    locks: move lease-specific code out of locks_delete_lock
    locks: prevent side-effects of locks_release_private before file_lock is initialized
    NFSd: set nfsd_serv to NULL after service destruction
    NFSd: introduce nfsd_destroy() helper
    ...

    Linus Torvalds
     

28 Jul, 2012

1 commit


27 Jul, 2012

1 commit

  • When calling fcntl(fd, F_SETLEASE, lck) [with lck=F_WRLCK or F_RDLCK],
    the custom signal or owner (if any were previously set using F_SETSIG
    or F_SETOWN fcntls) would be reset when F_SETLEASE was called for the
    second time on the same file descriptor.

    This bug is a regression of 2.6.37 and is described here:
    https://bugzilla.kernel.org/show_bug.cgi?id=43336

    This patch reverts a commit from Oct 2004 (with subject "nfs4 lease:
    move the f_delown processing") which originally introduced the
    lm_release_private callback.

    Signed-off-by: Filipe Brandenburger
    Signed-off-by: J. Bruce Fields

    Filipe Brandenburger
     

24 Jul, 2012

1 commit

  • The only checks of the long argument passed to fcntl(fd,F_SETLEASE,.)
    are done after converting the long to an int. Thus some illegal values
    may be let through and cause problems in later code.

    [ They actually *don't* cause problems in mainline, as of Dave Jones's
    commit 8d657eb3b438 "Remove easily user-triggerable BUG from
    generic_setlease", but we should fix this anyway. And this patch will
    be necessary to fix real bugs on earlier kernels. ]

    Cc: stable@vger.kernel.org
    Signed-off-by: J. Bruce Fields
    Signed-off-by: Linus Torvalds

    J. Bruce Fields
     

14 Jul, 2012

1 commit

  • This can be trivially triggered from userspace by passing in something unexpected.

    kernel BUG at fs/locks.c:1468!
    invalid opcode: 0000 [#1] SMP
    RIP: 0010:generic_setlease+0xc2/0x100
    Call Trace:
    __vfs_setlease+0x35/0x40
    fcntl_setlease+0x76/0x150
    sys_fcntl+0x1c6/0x810
    system_call_fastpath+0x1a/0x1f

    Signed-off-by: Dave Jones
    Cc: stable@kernel.org # 3.2+
    Signed-off-by: Linus Torvalds

    Dave Jones
     

30 May, 2012

1 commit


24 May, 2012

1 commit

  • Pull user namespace enhancements from Eric Biederman:
    "This is a course correction for the user namespace, so that we can
    reach an inexpensive, maintainable, and reasonably complete
    implementation.

    Highlights:
    - Config guards make it impossible to enable the user namespace and
    code that has not been converted to be user namespace safe.

    - Use of the new kuid_t type ensures the if you somehow get past the
    config guards the kernel will encounter type errors if you enable
    user namespaces and attempt to compile in code whose permission
    checks have not been updated to be user namespace safe.

    - All uids from child user namespaces are mapped into the initial
    user namespace before they are processed. Removing the need to add
    an additional check to see if the user namespace of the compared
    uids remains the same.

    - With the user namespaces compiled out the performance is as good or
    better than it is today.

    - For most operations absolutely nothing changes performance or
    operationally with the user namespace enabled.

    - The worst case performance I could come up with was timing 1
    billion cache cold stat operations with the user namespace code
    enabled. This went from 156s to 164s on my laptop (or 156ns to
    164ns per stat operation).

    - (uid_t)-1 and (gid_t)-1 are reserved as an internal error value.
    Most uid/gid setting system calls treat these value specially
    anyway so attempting to use -1 as a uid would likely cause
    entertaining failures in userspace.

    - If setuid is called with a uid that can not be mapped setuid fails.
    I have looked at sendmail, login, ssh and every other program I
    could think of that would call setuid and they all check for and
    handle the case where setuid fails.

    - If stat or a similar system call is called from a context in which
    we can not map a uid we lie and return overflowuid. The LFS
    experience suggests not lying and returning an error code might be
    better, but the historical precedent with uids is different and I
    can not think of anything that would break by lying about a uid we
    can't map.

    - Capabilities are localized to the current user namespace making it
    safe to give the initial user in a user namespace all capabilities.

    My git tree covers all of the modifications needed to convert the core
    kernel and enough changes to make a system bootable to runlevel 1."

    Fix up trivial conflicts due to nearby independent changes in fs/stat.c

    * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ebiederm/user-namespace: (46 commits)
    userns: Silence silly gcc warning.
    cred: use correct cred accessor with regards to rcu read lock
    userns: Convert the move_pages, and migrate_pages permission checks to use uid_eq
    userns: Convert cgroup permission checks to use uid_eq
    userns: Convert tmpfs to use kuid and kgid where appropriate
    userns: Convert sysfs to use kgid/kuid where appropriate
    userns: Convert sysctl permission checks to use kuid and kgids.
    userns: Convert proc to use kuid/kgid where appropriate
    userns: Convert ext4 to user kuid/kgid where appropriate
    userns: Convert ext3 to use kuid/kgid where appropriate
    userns: Convert ext2 to use kuid/kgid where appropriate.
    userns: Convert devpts to use kuid/kgid where appropriate
    userns: Convert binary formats to use kuid/kgid where appropriate
    userns: Add negative depends on entries to avoid building code that is userns unsafe
    userns: signal remove unnecessary map_cred_ns
    userns: Teach inode_capable to understand inodes whose uids map to other namespaces.
    userns: Fail exec for suid and sgid binaries with ids outside our user namespace.
    userns: Convert stat to return values mapped from kuids and kgids
    userns: Convert user specfied uids and gids in chown into kuids and kgid
    userns: Use uid_eq gid_eq helpers when comparing kuids and kgids in the vfs
    ...

    Linus Torvalds
     

03 May, 2012

1 commit


02 Apr, 2012

1 commit

  • We can deadlock if we have a write oplock and two processes
    use the same file handle. In this case the first process can't
    unlock its lock if the second process blocked on the lock in the
    same time.

    Fix it by using posix_lock_file rather than posix_lock_file_wait
    under cinode->lock_mutex. If we request a blocking lock and
    posix_lock_file indicates that there is another lock that prevents
    us, wait untill that lock is released and restart our call.

    Cc: stable@kernel.org
    Acked-by: Jeff Layton
    Signed-off-by: Pavel Shilovsky
    Signed-off-by: Steve French

    Pavel Shilovsky
     

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