From patchwork Fri Apr 5 16:57:55 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pavel Shilovsky X-Patchwork-Id: 2399371 Return-Path: X-Original-To: patchwork-cifs-client@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id BBFBCDF2E5 for ; Fri, 5 Apr 2013 16:55:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1422664Ab3DEQyW (ORCPT ); Fri, 5 Apr 2013 12:54:22 -0400 Received: from mail-la0-f50.google.com ([209.85.215.50]:63891 "EHLO mail-la0-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1422657Ab3DEQyS (ORCPT ); Fri, 5 Apr 2013 12:54:18 -0400 Received: by mail-la0-f50.google.com with SMTP id ec20so3607843lab.23 for ; Fri, 05 Apr 2013 09:54:16 -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=itkHkqgH8+N2A1f69L7s/WdcLMLzokAiM6CH8Kb2KKg=; b=aKwW8g7hg3u/PbMzVFYiAWN4AyReEH5DD7t3vC2bEXr1iqnxczOnTthB55QEjvT9JY O7h3wT5JomIZeoTOYRgwxXXent35NAJBLW1PVoVu/VdC/7KAGgXwyku7NY6pA6zLZ54R SYtMQ7RCPFa2XiTYNQoUMkIQ6CgwIXsRJyW3fySsZbavtb4x2DGoxEJR8JrWclWbRg6P IjbmaWxqc+eX/KF/+B/mWVksTKBGvLeI2WGiEHTNYTUKWyTU+L2db3683TwjJsq4P4Oo T1jAr2Gq3WcMyRzLp8P3EwbcB/rkJZII58fuSFpvtBwF8jb6YlU++Qz1ZzjQBZIJdMFq Yo9A== X-Received: by 10.112.125.129 with SMTP id mq1mr6566694lbb.116.1365180856392; Fri, 05 Apr 2013 09:54:16 -0700 (PDT) Received: from workstation.localdomain ([79.126.74.178]) by mx.google.com with ESMTPS id i3sm5744658lbn.0.2013.04.05.09.54.14 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 05 Apr 2013 09:54:15 -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 v4 7/7] locks: Disable LOCK_MAND support for MS_SHARELOCK mounts Date: Fri, 5 Apr 2013 20:57:55 +0400 Message-Id: <1365181075-22540-8-git-send-email-piastry@etersoft.ru> X-Mailer: git-send-email 1.8.1.5 In-Reply-To: <1365181075-22540-1-git-send-email-piastry@etersoft.ru> References: <1365181075-22540-1-git-send-email-piastry@etersoft.ru> Sender: linux-cifs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-cifs@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 ea5813c..8a59afb 100644 --- a/fs/locks.c +++ b/fs/locks.c @@ -1722,6 +1722,12 @@ SYSCALL_DEFINE2(flock, unsigned int, fd, unsigned int, cmd) if (!f.file) goto out; + /* Disable LOCK_MAND support for FS mounted with MS_SHARELOCK */ + if (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);