Received: by 2002:a05:7412:d1aa:b0:fc:a2b0:25d7 with SMTP id ba42csp1966556rdb; Wed, 31 Jan 2024 15:08:57 -0800 (PST) X-Google-Smtp-Source: AGHT+IGM7njcMMoKmZbLLV5LngdaT5S3cBkBbq+8ONDi8qJMJ/Az+m8B0GR84mL38RIOL20aq3nZ X-Received: by 2002:a05:622a:350:b0:42b:ed59:a83a with SMTP id r16-20020a05622a035000b0042bed59a83amr2466735qtw.25.1706742537375; Wed, 31 Jan 2024 15:08:57 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706742537; cv=pass; d=google.com; s=arc-20160816; b=fc4EmHnK3brtJBBg3aemFlinX1XpQNhZxZE0vfbINOUFWvHfWNR9TvdR8h4nCZz6BS FdgtipOkHYVmrgEcMjenA+lcXrsiTuWATV7rlURrJl4JIpRRhz3JDFx9VX58oTh8ND/Z M1rrFPwdvidLTOlFNECYaoK6Lycf6tJIesboWA2/WJLEmtyuK7mpYVjiWt1h3L3sdxFV mGGiPb21+pZJ9fv0u79Kxpd3mWxWEn10+HogK6+rQWQnilBBctMwE0xLwpWWnVt0EohY U0drz1N6QxArd6z5G4YwIriWPh8GXV4mcuXBbc2gCvSqhSddG/1xJSic02fet8gl1U1s uV3A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :subject:date:from:dkim-signature; bh=AYOCXWWxlsaDdtnpmjvpmcu+NJ3UZ/xj3avH+zWYXak=; fh=7NZiSAZrRYszuatpSaNV39b2cM2fzEN2iHI8EfXs2Vg=; b=C2901Z3jdf2AWpuk3CIHkQax/CqRa2WURl2s541uZB4cQouFq6jWvQFMPzyDvc16Vf UZFn4juOjsDsV8NWhzv0ofiDKGKwv4kPnWmgR89qTB2Lr/CF/Jh8lFW1X2v61UdIHYkq 6RzAn+Fyysg/Yn19nz+EncB7XLwneYvXs56RmUS0MJCVP94fdNtD7nxAnPYfdtD6MxPl 2D9WcNw6swHVhwL9zsT9s9AqSZ2x61/Ei3nXSDfw99au3VqDhNl36tUUqLNJjB5B6P5a 8LA52Xo+NLLPgJCIX8NhJJH8W+uu05vWGKDY9pydT0rOamG7oUo+xpa0EIVXyunEpS8n Bvtg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=jPaJihUo; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-nfs+bounces-1651-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-nfs+bounces-1651-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id x15-20020ac85f0f000000b0042a44ff8d09si13173789qta.518.2024.01.31.15.08.57 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 Jan 2024 15:08:57 -0800 (PST) Received-SPF: pass (google.com: domain of linux-nfs+bounces-1651-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=jPaJihUo; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-nfs+bounces-1651-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-nfs+bounces-1651-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 26E2D1C2593D for ; Wed, 31 Jan 2024 23:08:57 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B3CF73BB2C; Wed, 31 Jan 2024 23:03:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="jPaJihUo" X-Original-To: linux-nfs@vger.kernel.org Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 77CE84A9BF; Wed, 31 Jan 2024 23:03:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706742192; cv=none; b=rGfLpMD+Zb+fBNSTyAac6TbxT1aXJhdf/f+3OfcUvA8b3DwHdRquC4mhtcb862YTThPvapwLYsp1icOVq06OkDsjgo8apRkz4O4ArSZqOdk9gF2WcAoGAjo545y+oWG/oNBPw9KICqn+8LemiiZ6MXJ552klh2GsiKtIrlQpTqU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706742192; c=relaxed/simple; bh=sNOrCkTcYd2ehInJVAjwI61o+eqh8+BcNWvctRiFYlw=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=jvWh88l8qbwm5bqAvWMxZx9xMfSLNa3cF4iIfSmN9Qmd1Fzy6T+Uy8wxEn37rBtI+hGxwOLk9EnUHN66FN3cWlr5p2ZZFSuzpBF1MpgP9KLQnI1Ns7zrbYez6eL/D+pwcDQls7vrL9vVU5RnDQaRPxzXEUMnUMEg7x9dQc/efSQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=jPaJihUo; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3656AC43330; Wed, 31 Jan 2024 23:03:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1706742191; bh=sNOrCkTcYd2ehInJVAjwI61o+eqh8+BcNWvctRiFYlw=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=jPaJihUo28zQ6jJnl98vBQtGyyjGMtzVW5ofnzGXXU+QTRvh15v2RBIzVXnE2JFaO W1Cu7k+uH0yEh+e6pr4EIx+3m7Cmuu0iBVZvMwfVERr61y3TDefQNLlrBM2eqKa4FL kscevZqv+9C8H0SmoYtuM6o3cW5YxYYLT17q7Iah5phaEuTsvnRBb9bchyuRHcZB5N 5qxt/iEjtAf/z6JUO6qoQDD7icldKN+rA7J2YL/LOI0H1y8CiIqIXoR7t+EWxh1sAk aEOt5gPSJ3qqU/PmADYuY6BSwnL3Mej0uia1UEvudny2EEo7O+ehgLssIhfvbJASww QkNFb26yMDazw== From: Jeff Layton Date: Wed, 31 Jan 2024 18:01:55 -0500 Subject: [PATCH v3 14/47] smb/client: convert to using new filelock helpers Precedence: bulk X-Mailing-List: linux-nfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20240131-flsplit-v3-14-c6129007ee8d@kernel.org> References: <20240131-flsplit-v3-0-c6129007ee8d@kernel.org> In-Reply-To: <20240131-flsplit-v3-0-c6129007ee8d@kernel.org> To: Steven Rostedt , Masami Hiramatsu , Mathieu Desnoyers , Chuck Lever , Alexander Viro , Christian Brauner , Jan Kara , Eric Van Hensbergen , Latchesar Ionkov , Dominique Martinet , Christian Schoenebeck , David Howells , Marc Dionne , Xiubo Li , Ilya Dryomov , Alexander Aring , David Teigland , Andreas Gruenbacher , Neil Brown , Olga Kornievskaia , Dai Ngo , Tom Talpey , Trond Myklebust , Anna Schumaker , Mark Fasheh , Joel Becker , Joseph Qi , Steve French , Paulo Alcantara , Ronnie Sahlberg , Shyam Prasad N , Namjae Jeon , Sergey Senozhatsky , Miklos Szeredi Cc: linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, v9fs@lists.linux.dev, linux-afs@lists.infradead.org, ceph-devel@vger.kernel.org, gfs2@lists.linux.dev, linux-nfs@vger.kernel.org, ocfs2-devel@lists.linux.dev, linux-cifs@vger.kernel.org, Jeff Layton X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=openpgp-sha256; l=2139; i=jlayton@kernel.org; h=from:subject:message-id; bh=sNOrCkTcYd2ehInJVAjwI61o+eqh8+BcNWvctRiFYlw=; b=owEBbQKS/ZANAwAIAQAOaEEZVoIVAcsmYgBlutFwEGvApQjLFywG5KR4PXw94xatGEobs6Txc 96xMWLF+iuJAjMEAAEIAB0WIQRLwNeyRHGyoYTq9dMADmhBGVaCFQUCZbrRcAAKCRAADmhBGVaC FW/HD/9t/9RYMz4y8XwdaPmCmqiSG5Md5Xd11I35AaoOBOBMXwUeC3cIoizT7vcQHgG8OQQebCw NQOY+wmXxcYtqyJcbt9RiqqFybbWAQt4crYf6Bg5nKBHwm32QIdP6JJLMrFmAtbpp6hb2xWzHuz 5SvKSCIFWRslcz1JTSTnWgNed6rUapybXAi4K/adDvQTXEZuqB4vWFPXYkAR+sJ/2snfOgau0hR sMxvrdi/COJ7AepichAP3JvXKGu/elAe7g6lJ0MgLssb3b2olbt/Jl3XXdm4T4Q8+Odb/pJyP6M R2VBE9T3c8w/pVTEun2UStpcm1DH6U/tYHwaHK/Zq5zLT/d6NOIaftuaFxBMLqXVgVGggAc/5PM imB/qngELyOKiVRbx/KfMFtj6FOesJ3S7jZWWSu1uBwOlzvR5vS9btnKObUYgWfGgTOb7WW6lPp z+QjxOu+Byg8QBU4dhuT8w37Aulj/OeJ5p0xEsAebccb9B1JRie5m3LL2RkjVT6L2aihHdJL5sC GiHAJT7z+Qz0g8YhAk/jU9AlalNqbzGdxcIX7vh/6KsoNvwsjV/8MVwGSvfX8OYVBnYcQkexQbN h0VvHH7dz198ioRYLgTk60as7ToLb/qVHNxt+o5sTF/pQL6Iu6S2QAKlGgtres1FM9mSz9/wE8g pi2mqeC1DCCjf1A== X-Developer-Key: i=jlayton@kernel.org; a=openpgp; fpr=4BC0D7B24471B2A184EAF5D3000E684119568215 Convert to using the new file locking helper functions. Signed-off-by: Jeff Layton --- fs/smb/client/file.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/fs/smb/client/file.c b/fs/smb/client/file.c index b75282c204da..27f9ef4e69a8 100644 --- a/fs/smb/client/file.c +++ b/fs/smb/client/file.c @@ -1409,7 +1409,7 @@ cifs_posix_lock_test(struct file *file, struct file_lock *flock) down_read(&cinode->lock_sem); posix_test_lock(file, flock); - if (flock->fl_type == F_UNLCK && !cinode->can_cache_brlcks) { + if (lock_is_unlock(flock) && !cinode->can_cache_brlcks) { flock->fl_type = saved_type; rc = 1; } @@ -1581,7 +1581,7 @@ cifs_push_posix_locks(struct cifsFileInfo *cfile) el = locks_to_send.next; spin_lock(&flctx->flc_lock); - list_for_each_entry(flock, &flctx->flc_posix, fl_list) { + for_each_file_lock(flock, &flctx->flc_posix) { if (el == &locks_to_send) { /* * The list ended. We don't have enough allocated @@ -1591,7 +1591,7 @@ cifs_push_posix_locks(struct cifsFileInfo *cfile) break; } length = cifs_flock_len(flock); - if (flock->fl_type == F_RDLCK || flock->fl_type == F_SHLCK) + if (lock_is_read(flock) || flock->fl_type == F_SHLCK) type = CIFS_RDLCK; else type = CIFS_WRLCK; @@ -1681,16 +1681,16 @@ cifs_read_flock(struct file_lock *flock, __u32 *type, int *lock, int *unlock, cifs_dbg(FYI, "Unknown lock flags 0x%x\n", flock->fl_flags); *type = server->vals->large_lock_type; - if (flock->fl_type == F_WRLCK) { + if (lock_is_write(flock)) { cifs_dbg(FYI, "F_WRLCK\n"); *type |= server->vals->exclusive_lock_type; *lock = 1; - } else if (flock->fl_type == F_UNLCK) { + } else if (lock_is_unlock(flock)) { cifs_dbg(FYI, "F_UNLCK\n"); *type |= server->vals->unlock_lock_type; *unlock = 1; /* Check if unlock includes more than one lock range */ - } else if (flock->fl_type == F_RDLCK) { + } else if (lock_is_read(flock)) { cifs_dbg(FYI, "F_RDLCK\n"); *type |= server->vals->shared_lock_type; *lock = 1; -- 2.43.0