From patchwork Mon Jul 1 16:49:59 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pavel Shilovsky X-Patchwork-Id: 2808821 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 AFA429F3C3 for ; Mon, 1 Jul 2013 16:43:53 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D45AC201BC for ; Mon, 1 Jul 2013 16:43:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id F407F201BA for ; Mon, 1 Jul 2013 16:43:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752197Ab3GAQn2 (ORCPT ); Mon, 1 Jul 2013 12:43:28 -0400 Received: from mail-lb0-f176.google.com ([209.85.217.176]:58227 "EHLO mail-lb0-f176.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754656Ab3GAQnJ (ORCPT ); Mon, 1 Jul 2013 12:43:09 -0400 Received: by mail-lb0-f176.google.com with SMTP id z5so2566135lbh.21 for ; Mon, 01 Jul 2013 09:43:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references; bh=ifpNknqiPeGD6cpWRrnGhBPHDKRKVwmFyJmM7fm682o=; b=b2jkh/TDN1UHlS/MoRZEAws1Ybhk+BC/BIEdNy2N/qMfdlyWSuAGowXuhYEDeCzBEf VBVcH5wSbLyp8NqE59DlzMTbENGV1mdg5KO43ukQgWvdX4QO3YM45WMYrycUowZ+/qtU V6TdoysKxQTUiLf1AqfbbWmdfPEJv0sYwzpRbyq747juZBxPkgdEi1IzP0+1ZwVhBNeq ynuV/ZuzEzePRu7Tb2kGWzkvGA8cYe99FPAutO4ufAzevRGlxXmBzHymdTPaUjNMQZCH psMULFVX9ouONTd4vPZJMBZsZkn/VlHJOQadKBVeOiSQJBHfkCbX3Zs9hP5BsjFnpjqV lP/g== X-Received: by 10.152.121.73 with SMTP id li9mr12535551lab.42.1372696987505; Mon, 01 Jul 2013 09:43:07 -0700 (PDT) Received: from workstation.localdomain (PPPoE-78-29-83-145.san.ru. [78.29.83.145]) by mx.google.com with ESMTPSA id m1sm7595442lag.3.2013.07.01.09.43.05 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 01 Jul 2013 09:43:06 -0700 (PDT) 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 7/7] locks: Disable LOCK_MAND support for MS_SHARELOCK mounts Date: Mon, 1 Jul 2013 20:49:59 +0400 Message-Id: <1372697399-21361-8-git-send-email-piastry@etersoft.ru> X-Mailer: git-send-email 1.8.1.5 In-Reply-To: <1372697399-21361-1-git-send-email-piastry@etersoft.ru> References: <1372697399-21361-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=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=unavailable 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 60f3ce8..86f3a93 100644 --- a/fs/locks.c +++ b/fs/locks.c @@ -1758,6 +1758,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);