From patchwork Fri Jan 17 10:07:08 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pavel Shilovsky X-Patchwork-Id: 3503451 Return-Path: X-Original-To: patchwork-linux-nfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 5EF439F32F for ; Fri, 17 Jan 2014 10:10:19 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 518A120165 for ; Fri, 17 Jan 2014 10:10:18 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 562D220148 for ; Fri, 17 Jan 2014 10:10:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752595AbaAQKJu (ORCPT ); Fri, 17 Jan 2014 05:09:50 -0500 Received: from mail-la0-f42.google.com ([209.85.215.42]:48879 "EHLO mail-la0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752321AbaAQKHe (ORCPT ); Fri, 17 Jan 2014 05:07:34 -0500 Received: by mail-la0-f42.google.com with SMTP id hr13so1406504lab.29 for ; Fri, 17 Jan 2014 02:07:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=QMyTR6ojA0OCFkJzTNrs1GQ2k8F+9t6ICRitFPt2N/8=; b=Ac/a/1J/ZC45cXGF4dQ5A2cVP2ypF7akVjWHZpj7Z8RUdigW+T9GgVBmXs4e39YtSu CdXiyly/gg0tRsUNcBf/sPj5HOhz/Zp+j3S/HTr472LSrEuXfOWFHMOy1ku4KCIchYxr 9pEFsYmvDX60uDC22HIXVIqCCFiV/JfsMOBrxA9adPu4zt9AF2FYs+AKYtUvMfG5UfQk 8nipQZsGqXs25jLm5s86mqKefl4ql0dlI4oXNX1Sr+yja7osuf0Ma7cxAcKRhW/wd3Ky 6Q17jubMkVdHwLaDgw5w5z5asHQAl2HQCl7+tKf2uzviKqGUon+mD4YEWtzEsrSGWc6f 0jRg== X-Received: by 10.112.89.42 with SMTP id bl10mr574607lbb.18.1389953252899; Fri, 17 Jan 2014 02:07:32 -0800 (PST) Received: from localhost.localdomain ([92.43.3.2]) by mx.google.com with ESMTPSA id e6sm6430005lbs.3.2014.01.17.02.07.30 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 17 Jan 2014 02:07:31 -0800 (PST) From: Pavel Shilovsky 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 v7 3/7] locks: Disable LOCK_MAND support for MS_SHARELOCK mounts Date: Fri, 17 Jan 2014 14:07:08 +0400 Message-Id: <1389953232-9428-4-git-send-email-piastry@etersoft.ru> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1389953232-9428-1-git-send-email-piastry@etersoft.ru> References: <1389953232-9428-1-git-send-email-piastry@etersoft.ru> Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Pavel Shilovsky --- fs/locks.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/fs/locks.c b/fs/locks.c index 7ecc511..c7e780a 100644 --- a/fs/locks.c +++ b/fs/locks.c @@ -1904,6 +1904,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);