From patchwork Tue Apr 9 12:40:27 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pavel Shilovsky X-Patchwork-Id: 2415071 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 79C57DF25A for ; Tue, 9 Apr 2013 12:37:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S964959Ab3DIMgs (ORCPT ); Tue, 9 Apr 2013 08:36:48 -0400 Received: from mail-lb0-f174.google.com ([209.85.217.174]:59843 "EHLO mail-lb0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S964846Ab3DIMgq (ORCPT ); Tue, 9 Apr 2013 08:36:46 -0400 Received: by mail-lb0-f174.google.com with SMTP id s10so6796193lbi.19 for ; Tue, 09 Apr 2013 05:36:44 -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=PPYKPWt74ZZtYo5SotdI8PbdvN609vHu58XGa1aqwms=; b=p4wFMuCN28ZIja6MFSTSumJ2YgaINCApLWJ3bzsFVPqQIRalneQfaNe9wQdpdWRJ/y EYlhER6H189AGjnftghlP/x7YbgBqm/t3IySnzYXW70uxyUGxIHBJQlvTeJHEbrIyYX7 RHO9fMARbVxGWaDeLbOs8XVV+QVd8Uh1K0yOU7FdJsUk0PskSznPtAnIj9SaeuGmp7ql NirYisFygdXfu8qBArXX0JbNFr2fpKTHeB2c0H92AkYb3EzZHt+5zP+njuMyGpLO/B/6 hOxhbWN1hqK+zuUtYrx9Bh2M1p3v6p3ULcyY9XgooWQEruq0COA5bOx2mcrJRmSfVPA7 d+0g== X-Received: by 10.112.199.104 with SMTP id jj8mr9986839lbc.20.1365511004676; Tue, 09 Apr 2013 05:36:44 -0700 (PDT) Received: from workstation.localdomain (PPPoE-78-29-80-229.san.ru. [78.29.80.229]) by mx.google.com with ESMTPS id i3sm12413591lbn.0.2013.04.09.05.36.42 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 09 Apr 2013 05:36:43 -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 v5 7/7] locks: Disable LOCK_MAND support for MS_SHARELOCK mounts Date: Tue, 9 Apr 2013 16:40:27 +0400 Message-Id: <1365511227-17626-8-git-send-email-piastry@etersoft.ru> X-Mailer: git-send-email 1.8.1.5 In-Reply-To: <1365511227-17626-1-git-send-email-piastry@etersoft.ru> References: <1365511227-17626-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 1402a43..a67857c 100644 --- a/fs/locks.c +++ b/fs/locks.c @@ -1719,6 +1719,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);