1 From 107077a193a5c35e83ab3ba890c429f31736d055 Mon Sep 17 00:00:00 2001
2 From: Ned Bass <bass6@llnl.gov>
3 Date: Thu, 16 Oct 2014 13:52:56 -0700
4 Subject: [PATCH] Remove checks for mandatory locks
6 The Linux VFS handles mandatory locks generically so we shouldn't
7 need to check for conflicting locks in zfs_read(), zfs_write(), or
8 zfs_freesp(). Linux 3.18 removed the lock_may_read() and
9 lock_may_write() interfaces which we were relying on for this
10 purpose. Rather than emulating those interfaces we remove the
13 Signed-off-by: Ned Bass <bass6@llnl.gov>
14 Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
17 module/zfs/zfs_vnops.c | 18 ------------------
18 module/zfs/zfs_znode.c | 10 ----------
19 2 files changed, 28 deletions(-)
21 diff --git a/module/zfs/zfs_vnops.c b/module/zfs/zfs_vnops.c
22 index 4f53173..02fab99 100644
23 --- a/module/zfs/zfs_vnops.c
24 +++ b/module/zfs/zfs_vnops.c
25 @@ -471,15 +471,6 @@ zfs_read(struct inode *ip, uio_t *uio, int ioflag, cred_t *cr)
29 - * Check for mandatory locks
31 - if (mandatory_lock(ip) &&
32 - !lock_may_read(ip, uio->uio_loffset, uio->uio_resid)) {
34 - return (SET_ERROR(EAGAIN));
38 * If we're in FRSYNC mode, sync out this znode before reading it.
40 if (ioflag & FRSYNC || zsb->z_os->os_sync == ZFS_SYNC_ALWAYS)
41 @@ -648,15 +639,6 @@ zfs_write(struct inode *ip, uio_t *uio, int ioflag, cred_t *cr)
45 - * Check for mandatory locks before calling zfs_range_lock()
46 - * in order to prevent a deadlock with locks set via fcntl().
48 - if (mandatory_lock(ip) && !lock_may_write(ip, woff, n)) {
50 - return (SET_ERROR(EAGAIN));
54 * Pre-fault the pages to ensure slow (eg NFS) pages
56 * Skip this if uio contains loaned arc_buf.
57 diff --git a/module/zfs/zfs_znode.c b/module/zfs/zfs_znode.c
58 index 23e0907..a7ef07c 100644
59 --- a/module/zfs/zfs_znode.c
60 +++ b/module/zfs/zfs_znode.c
61 @@ -1471,7 +1471,6 @@ zfs_trunc(znode_t *zp, uint64_t end)
63 zfs_freesp(znode_t *zp, uint64_t off, uint64_t len, int flag, boolean_t log)
65 - struct inode *ip = ZTOI(zp);
67 zfs_sb_t *zsb = ZTOZSB(zp);
68 zilog_t *zilog = zsb->z_log;
69 @@ -1493,15 +1492,6 @@ zfs_freesp(znode_t *zp, uint64_t off, uint64_t len, int flag, boolean_t log)
74 - * Check for any locks in the region to be freed.
76 - if (ip->i_flock && mandatory_lock(ip)) {
77 - uint64_t length = (len ? len : zp->z_size - off);
78 - if (!lock_may_write(ip, off, length))
79 - return (SET_ERROR(EAGAIN));
83 error = zfs_trunc(zp, off);