From patchwork Fri Apr 26 12:04:21 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pavel Shilovsky X-Patchwork-Id: 2493091 Return-Path: X-Original-To: patchwork-linux-nfs@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id A3C173FDC4 for ; Fri, 26 Apr 2013 12:00:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754600Ab3DZMAi (ORCPT ); Fri, 26 Apr 2013 08:00:38 -0400 Received: from mail-lb0-f170.google.com ([209.85.217.170]:59624 "EHLO mail-lb0-f170.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753884Ab3DZMAH (ORCPT ); Fri, 26 Apr 2013 08:00:07 -0400 Received: by mail-lb0-f170.google.com with SMTP id r10so3140559lbi.15 for ; Fri, 26 Apr 2013 05:00:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:sender:from:to:cc:subject:date:message-id:x-mailer :in-reply-to:references; bh=FyGeqipDj1qdbKBB60rjimocnjiBlQEvvSRwFYZsG0I=; b=T2QMAueT2xDogJmZ2n8jHxzAfC5ScZJU/IeZR2qh0sQms2/eGoJo7WQJZkpzwtwMrF PyPL9XK24qrmaMAlO6yzxGMnajtC7KbCpuMHNbj0Xo4q1j+eHHir7K6E+zKFcNbCuFxq g/+jX1pID/xneqedWxBMBnA9ABuDqpwNJAiYGMt8fymtbTeT58j7uWtVfr75wdw6DqG7 Azegwnyul03BfHO+sGhPySC6CxwqlX5uOS3/zNQT2J+/kw8q1d+I4gTZ5oVrXmIukKxV ZW1solvGE9pV+AmeoBfOzky3LMr2a6DH295q0vdRnF9inaENJy1AxhktY/36ZveYSi17 3dpw== X-Received: by 10.112.143.233 with SMTP id sh9mr21044501lbb.106.1366977605083; Fri, 26 Apr 2013 05:00:05 -0700 (PDT) Received: from workstation.localdomain ([95.84.52.86]) by mx.google.com with ESMTPSA id q4sm4461237lbi.14.2013.04.26.05.00.03 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 26 Apr 2013 05:00:04 -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 v6 7/7] locks: Disable LOCK_MAND support for MS_SHARELOCK mounts Date: Fri, 26 Apr 2013 16:04:21 +0400 Message-Id: <1366977861-27678-8-git-send-email-piastry@etersoft.ru> X-Mailer: git-send-email 1.8.1.5 In-Reply-To: <1366977861-27678-1-git-send-email-piastry@etersoft.ru> References: <1366977861-27678-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 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 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);