linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pavel Shilovsky <piastry@etersoft.ru>
To: linux-kernel@vger.kernel.org
Cc: linux-cifs@vger.kernel.org, linux-fsdevel@vger.kernel.org,
	linux-nfs@vger.kernel.org, wine-devel@winehq.org
Subject: [PATCH v6 7/7] locks: Disable LOCK_MAND support for MS_SHARELOCK mounts
Date: Fri, 26 Apr 2013 16:04:21 +0400	[thread overview]
Message-ID: <1366977861-27678-8-git-send-email-piastry@etersoft.ru> (raw)
In-Reply-To: <1366977861-27678-1-git-send-email-piastry@etersoft.ru>

Signed-off-by: Pavel Shilovsky <piastry@etersoft.ru>
---
 fs/locks.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/fs/locks.c b/fs/locks.c
index 25c3a49..7d67e0e 100644
--- a/fs/locks.c
+++ b/fs/locks.c
@@ -1756,6 +1756,12 @@ SYSCALL_DEFINE2(flock, unsigned int, fd, unsigned int, cmd)
 		goto out;
 	}
 
+	/* Disable LOCK_MAND support for FS mounted with MS_SHARELOCK */
+	if ((cmd & LOCK_MAND) && IS_SHARELOCK(f.file->f_path.dentry->d_inode)) {
+		error = -EPERM;
+		goto out;
+	}
+
 	can_sleep = !(cmd & LOCK_NB);
 	cmd &= ~LOCK_NB;
 	unlock = (cmd == LOCK_UN);
-- 
1.8.1.5

      parent reply	other threads:[~2013-04-26 12:04 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-26 12:04 [PATCH v6 0/7] Add O_DENY* support for VFS and CIFS/NFS Pavel Shilovsky
2013-04-26 12:04 ` [PATCH v6 1/7] VFS: Introduce new O_DENY* open flags Pavel Shilovsky
2013-06-11 12:04   ` Jeff Layton
2013-04-26 12:04 ` [PATCH v6 3/7] CIFS: Add share_access parm to open request Pavel Shilovsky
     [not found] ` <1366977861-27678-1-git-send-email-piastry-7qunaywFIewox3rIn2DAYQ@public.gmane.org>
2013-04-26 12:04   ` [PATCH v6 2/7] VFS: Add O_DENYDELETE support for VFS Pavel Shilovsky
     [not found]     ` <1366977861-27678-3-git-send-email-piastry-7qunaywFIewox3rIn2DAYQ@public.gmane.org>
2013-05-10 11:09       ` Jeff Layton
     [not found]         ` <20130510070959.0af3e35a-9yPaYZwiELC+kQycOl6kW4xkIHaj4LzF@public.gmane.org>
2013-05-13 17:50           ` Pavel Shilovsky
2013-05-14  6:23             ` Jeff Layton
2013-06-11 12:09       ` Jeff Layton
     [not found]         ` <20130611080906.5a9d0384-4QP7MXygkU+dMjc06nkz3ljfA9RmPOcC@public.gmane.org>
2013-06-11 12:18           ` Pavel Shilovsky
2013-04-26 12:04   ` [PATCH v6 4/7] CIFS: Add O_DENY* open flags support Pavel Shilovsky
2013-04-26 12:04   ` [PATCH v6 6/7] NFSD: Pass share reservations flags to VFS Pavel Shilovsky
2013-04-26 12:04 ` [PATCH v6 5/7] NFSv4: Add O_DENY* open flags support Pavel Shilovsky
2013-04-26 12:04 ` Pavel Shilovsky [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1366977861-27678-8-git-send-email-piastry@etersoft.ru \
    --to=piastry@etersoft.ru \
    --cc=linux-cifs@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-nfs@vger.kernel.org \
    --cc=wine-devel@winehq.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).