diff options
author | J. Bruce Fields <bfields@redhat.com> | 2012-10-09 18:35:22 -0400 |
---|---|---|
committer | J. Bruce Fields <bfields@redhat.com> | 2012-10-09 18:35:22 -0400 |
commit | f474af7051212b4efc8267583fad9c4ebf33ccff (patch) | |
tree | 1aa46ebc8065a341f247c2a2d9af2f624ad1d4f8 /fs/locks.c | |
parent | 0d22f68f02c10d5d10ec5712917e5828b001a822 (diff) | |
parent | e3dd9a52cb5552c46c2a4ca7ccdfb4dab5c72457 (diff) |
nfs: disintegrate UAPI for nfs
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 <bfields@redhat.com>
Diffstat (limited to 'fs/locks.c')
-rw-r--r-- | fs/locks.c | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/fs/locks.c b/fs/locks.c index 669911e4af9d..a94e331a52a2 100644 --- a/fs/locks.c +++ b/fs/locks.c | |||
@@ -1625,15 +1625,13 @@ EXPORT_SYMBOL(flock_lock_file_wait); | |||
1625 | */ | 1625 | */ |
1626 | SYSCALL_DEFINE2(flock, unsigned int, fd, unsigned int, cmd) | 1626 | SYSCALL_DEFINE2(flock, unsigned int, fd, unsigned int, cmd) |
1627 | { | 1627 | { |
1628 | struct file *filp; | 1628 | struct fd f = fdget(fd); |
1629 | int fput_needed; | ||
1630 | struct file_lock *lock; | 1629 | struct file_lock *lock; |
1631 | int can_sleep, unlock; | 1630 | int can_sleep, unlock; |
1632 | int error; | 1631 | int error; |
1633 | 1632 | ||
1634 | error = -EBADF; | 1633 | error = -EBADF; |
1635 | filp = fget_light(fd, &fput_needed); | 1634 | if (!f.file) |
1636 | if (!filp) | ||
1637 | goto out; | 1635 | goto out; |
1638 | 1636 | ||
1639 | can_sleep = !(cmd & LOCK_NB); | 1637 | can_sleep = !(cmd & LOCK_NB); |
@@ -1641,31 +1639,31 @@ SYSCALL_DEFINE2(flock, unsigned int, fd, unsigned int, cmd) | |||
1641 | unlock = (cmd == LOCK_UN); | 1639 | unlock = (cmd == LOCK_UN); |
1642 | 1640 | ||
1643 | if (!unlock && !(cmd & LOCK_MAND) && | 1641 | if (!unlock && !(cmd & LOCK_MAND) && |
1644 | !(filp->f_mode & (FMODE_READ|FMODE_WRITE))) | 1642 | !(f.file->f_mode & (FMODE_READ|FMODE_WRITE))) |
1645 | goto out_putf; | 1643 | goto out_putf; |
1646 | 1644 | ||
1647 | error = flock_make_lock(filp, &lock, cmd); | 1645 | error = flock_make_lock(f.file, &lock, cmd); |
1648 | if (error) | 1646 | if (error) |
1649 | goto out_putf; | 1647 | goto out_putf; |
1650 | if (can_sleep) | 1648 | if (can_sleep) |
1651 | lock->fl_flags |= FL_SLEEP; | 1649 | lock->fl_flags |= FL_SLEEP; |
1652 | 1650 | ||
1653 | error = security_file_lock(filp, lock->fl_type); | 1651 | error = security_file_lock(f.file, lock->fl_type); |
1654 | if (error) | 1652 | if (error) |
1655 | goto out_free; | 1653 | goto out_free; |
1656 | 1654 | ||
1657 | if (filp->f_op && filp->f_op->flock) | 1655 | if (f.file->f_op && f.file->f_op->flock) |
1658 | error = filp->f_op->flock(filp, | 1656 | error = f.file->f_op->flock(f.file, |
1659 | (can_sleep) ? F_SETLKW : F_SETLK, | 1657 | (can_sleep) ? F_SETLKW : F_SETLK, |
1660 | lock); | 1658 | lock); |
1661 | else | 1659 | else |
1662 | error = flock_lock_file_wait(filp, lock); | 1660 | error = flock_lock_file_wait(f.file, lock); |
1663 | 1661 | ||
1664 | out_free: | 1662 | out_free: |
1665 | locks_free_lock(lock); | 1663 | locks_free_lock(lock); |
1666 | 1664 | ||
1667 | out_putf: | 1665 | out_putf: |
1668 | fput_light(filp, fput_needed); | 1666 | fdput(f); |
1669 | out: | 1667 | out: |
1670 | return error; | 1668 | return error; |
1671 | } | 1669 | } |