* [PATCH] nfs: local_lock: handle async processing of F_SETLK with FL_SLEEP
@ 2021-12-27 10:45 Vasily Averin
2021-12-27 12:59 ` kernel test robot
0 siblings, 1 reply; 8+ messages in thread
From: Vasily Averin @ 2021-12-27 10:45 UTC (permalink / raw)
To: Trond Myklebust, Anna Schumaker; +Cc: kernel, linux-nfs, linux-kernel
nfsd and lockd use F_SETLK cmd with the FL_SLEEP flag set to request
asynchronous processing of blocking locks.
Currently nfs mounted with 'local_lock' option use locks_lock_file_wait()
function blocked on such requests.
To handle such requests properly, non-blocking posix_file_lock()
function should be used instead.
https://bugzilla.kernel.org/show_bug.cgi?id=215383
Signed-off-by: Vasily Averin <vvs@virtuozzo.com>
---
fs/nfs/file.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/fs/nfs/file.c b/fs/nfs/file.c
index 24e7dccce355..c9c974ee2f43 100644
--- a/fs/nfs/file.c
+++ b/fs/nfs/file.c
@@ -769,9 +769,11 @@ do_setlk(struct file *filp, int cmd, struct file_lock *fl, int is_local)
*/
if (!is_local)
status = NFS_PROTO(inode)->lock(filp, cmd, fl);
+ else if ((fl->fl_flags && FL_SLEEP) && IS_SETLK(cmd))
+ status = posix_lock_file(filp, fl, NULL);
else
status = locks_lock_file_wait(filp, fl);
- if (status < 0)
+ if (status)
goto out;
/*
--
2.25.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH] nfs: local_lock: handle async processing of F_SETLK with FL_SLEEP
2021-12-27 10:45 [PATCH] nfs: local_lock: handle async processing of F_SETLK with FL_SLEEP Vasily Averin
@ 2021-12-27 12:59 ` kernel test robot
0 siblings, 0 replies; 8+ messages in thread
From: kernel test robot @ 2021-12-27 12:59 UTC (permalink / raw)
To: Vasily Averin, Trond Myklebust, Anna Schumaker
Cc: llvm, kbuild-all, kernel, linux-nfs, linux-kernel
Hi Vasily,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on trondmy-nfs/linux-next]
[also build test WARNING on v5.16-rc7 next-20211224]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Vasily-Averin/nfs-local_lock-handle-async-processing-of-F_SETLK-with-FL_SLEEP/20211227-184705
base: git://git.linux-nfs.org/projects/trondmy/linux-nfs.git linux-next
config: i386-randconfig-r034-20211227 (https://download.01.org/0day-ci/archive/20211227/202112272042.Xlz50x0x-lkp@intel.com/config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 511726c64d3b6cca66f7c54d457d586aa3129f67)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/00e7edbaaa914f1b049ab8a652c5a91483f4141d
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Vasily-Averin/nfs-local_lock-handle-async-processing-of-F_SETLK-with-FL_SLEEP/20211227-184705
git checkout 00e7edbaaa914f1b049ab8a652c5a91483f4141d
# save the config file to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=i386 SHELL=/bin/bash fs/nfs/
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
All warnings (new ones prefixed by >>):
>> fs/nfs/file.c:772:25: warning: use of logical '&&' with constant operand [-Wconstant-logical-operand]
else if ((fl->fl_flags && FL_SLEEP) && IS_SETLK(cmd))
^ ~~~~~~~~
fs/nfs/file.c:772:25: note: use '&' for a bitwise operation
else if ((fl->fl_flags && FL_SLEEP) && IS_SETLK(cmd))
^~
&
fs/nfs/file.c:772:25: note: remove constant to silence this warning
else if ((fl->fl_flags && FL_SLEEP) && IS_SETLK(cmd))
~^~~~~~~~~~~
1 warning generated.
vim +772 fs/nfs/file.c
751
752 static int
753 do_setlk(struct file *filp, int cmd, struct file_lock *fl, int is_local)
754 {
755 struct inode *inode = filp->f_mapping->host;
756 int status;
757
758 /*
759 * Flush all pending writes before doing anything
760 * with locks..
761 */
762 status = nfs_sync_mapping(filp->f_mapping);
763 if (status != 0)
764 goto out;
765
766 /*
767 * Use local locking if mounted with "-onolock" or with appropriate
768 * "-olocal_lock="
769 */
770 if (!is_local)
771 status = NFS_PROTO(inode)->lock(filp, cmd, fl);
> 772 else if ((fl->fl_flags && FL_SLEEP) && IS_SETLK(cmd))
773 status = posix_lock_file(filp, fl, NULL);
774 else
775 status = locks_lock_file_wait(filp, fl);
776 if (status)
777 goto out;
778
779 /*
780 * Invalidate cache to prevent missing any changes. If
781 * the file is mapped, clear the page cache as well so
782 * those mappings will be loaded.
783 *
784 * This makes locking act as a cache coherency point.
785 */
786 nfs_sync_mapping(filp->f_mapping);
787 if (!NFS_PROTO(inode)->have_delegation(inode, FMODE_READ)) {
788 nfs_zap_caches(inode);
789 if (mapping_mapped(filp->f_mapping))
790 nfs_revalidate_mapping(inode, filp->f_mapping);
791 }
792 out:
793 return status;
794 }
795
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] nfs: local_lock: handle async processing of F_SETLK with FL_SLEEP
@ 2021-12-27 12:59 ` kernel test robot
0 siblings, 0 replies; 8+ messages in thread
From: kernel test robot @ 2021-12-27 12:59 UTC (permalink / raw)
To: kbuild-all
[-- Attachment #1: Type: text/plain, Size: 3962 bytes --]
Hi Vasily,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on trondmy-nfs/linux-next]
[also build test WARNING on v5.16-rc7 next-20211224]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Vasily-Averin/nfs-local_lock-handle-async-processing-of-F_SETLK-with-FL_SLEEP/20211227-184705
base: git://git.linux-nfs.org/projects/trondmy/linux-nfs.git linux-next
config: i386-randconfig-r034-20211227 (https://download.01.org/0day-ci/archive/20211227/202112272042.Xlz50x0x-lkp(a)intel.com/config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 511726c64d3b6cca66f7c54d457d586aa3129f67)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/00e7edbaaa914f1b049ab8a652c5a91483f4141d
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Vasily-Averin/nfs-local_lock-handle-async-processing-of-F_SETLK-with-FL_SLEEP/20211227-184705
git checkout 00e7edbaaa914f1b049ab8a652c5a91483f4141d
# save the config file to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=i386 SHELL=/bin/bash fs/nfs/
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
All warnings (new ones prefixed by >>):
>> fs/nfs/file.c:772:25: warning: use of logical '&&' with constant operand [-Wconstant-logical-operand]
else if ((fl->fl_flags && FL_SLEEP) && IS_SETLK(cmd))
^ ~~~~~~~~
fs/nfs/file.c:772:25: note: use '&' for a bitwise operation
else if ((fl->fl_flags && FL_SLEEP) && IS_SETLK(cmd))
^~
&
fs/nfs/file.c:772:25: note: remove constant to silence this warning
else if ((fl->fl_flags && FL_SLEEP) && IS_SETLK(cmd))
~^~~~~~~~~~~
1 warning generated.
vim +772 fs/nfs/file.c
751
752 static int
753 do_setlk(struct file *filp, int cmd, struct file_lock *fl, int is_local)
754 {
755 struct inode *inode = filp->f_mapping->host;
756 int status;
757
758 /*
759 * Flush all pending writes before doing anything
760 * with locks..
761 */
762 status = nfs_sync_mapping(filp->f_mapping);
763 if (status != 0)
764 goto out;
765
766 /*
767 * Use local locking if mounted with "-onolock" or with appropriate
768 * "-olocal_lock="
769 */
770 if (!is_local)
771 status = NFS_PROTO(inode)->lock(filp, cmd, fl);
> 772 else if ((fl->fl_flags && FL_SLEEP) && IS_SETLK(cmd))
773 status = posix_lock_file(filp, fl, NULL);
774 else
775 status = locks_lock_file_wait(filp, fl);
776 if (status)
777 goto out;
778
779 /*
780 * Invalidate cache to prevent missing any changes. If
781 * the file is mapped, clear the page cache as well so
782 * those mappings will be loaded.
783 *
784 * This makes locking act as a cache coherency point.
785 */
786 nfs_sync_mapping(filp->f_mapping);
787 if (!NFS_PROTO(inode)->have_delegation(inode, FMODE_READ)) {
788 nfs_zap_caches(inode);
789 if (mapping_mapped(filp->f_mapping))
790 nfs_revalidate_mapping(inode, filp->f_mapping);
791 }
792 out:
793 return status;
794 }
795
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH v2] nfs: local_lock: handle async processing of F_SETLK with FL_SLEEP
2021-12-27 12:59 ` kernel test robot
(?)
@ 2021-12-27 15:50 ` Vasily Averin
2021-12-28 1:00 ` Vasily Averin
-1 siblings, 1 reply; 8+ messages in thread
From: Vasily Averin @ 2021-12-27 15:50 UTC (permalink / raw)
To: Trond Myklebust, Anna Schumaker; +Cc: kernel, linux-nfs, linux-kernel
nfsd and lockd use F_SETLK cmd with the FL_SLEEP flag set to request
asynchronous processing of blocking locks.
Currently nfs mounted with 'local_lock' option use locks_lock_file_wait()
function blocked on such requests.
To handle such requests properly, non-blocking posix_file_lock()
function should be used instead.
https://bugzilla.kernel.org/show_bug.cgi?id=215383
Signed-off-by: Vasily Averin <vvs@virtuozzo.com>
---
v2: fixed 'fl_flags && FL_SLEEP' => 'fl_flags & FL_SLEEP'
---
fs/nfs/file.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/fs/nfs/file.c b/fs/nfs/file.c
index 24e7dccce355..38e1821cff5d 100644
--- a/fs/nfs/file.c
+++ b/fs/nfs/file.c
@@ -769,9 +769,11 @@ do_setlk(struct file *filp, int cmd, struct file_lock *fl, int is_local)
*/
if (!is_local)
status = NFS_PROTO(inode)->lock(filp, cmd, fl);
+ else if ((fl->fl_flags & FL_SLEEP) && IS_SETLK(cmd))
+ status = posix_lock_file(filp, fl, NULL);
else
status = locks_lock_file_wait(filp, fl);
- if (status < 0)
+ if (status)
goto out;
/*
--
2.25.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH v2] nfs: local_lock: handle async processing of F_SETLK with FL_SLEEP
2021-12-27 15:50 ` [PATCH v2] " Vasily Averin
@ 2021-12-28 1:00 ` Vasily Averin
0 siblings, 0 replies; 8+ messages in thread
From: Vasily Averin @ 2021-12-28 1:00 UTC (permalink / raw)
To: Trond Myklebust, Anna Schumaker; +Cc: kernel, linux-nfs, linux-kernel
Patch is wrong,
I missed that FL_FLOCK are handled here too.
On 27.12.2021 18:50, Vasily Averin wrote:
> nfsd and lockd use F_SETLK cmd with the FL_SLEEP flag set to request
> asynchronous processing of blocking locks.
>
> Currently nfs mounted with 'local_lock' option use locks_lock_file_wait()
> function blocked on such requests.
>
> To handle such requests properly, non-blocking posix_file_lock()
> function should be used instead.
>
> https://bugzilla.kernel.org/show_bug.cgi?id=215383
> Signed-off-by: Vasily Averin <vvs@virtuozzo.com>
> ---
> v2: fixed 'fl_flags && FL_SLEEP' => 'fl_flags & FL_SLEEP'
> ---
> fs/nfs/file.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/fs/nfs/file.c b/fs/nfs/file.c
> index 24e7dccce355..38e1821cff5d 100644
> --- a/fs/nfs/file.c
> +++ b/fs/nfs/file.c
> @@ -769,9 +769,11 @@ do_setlk(struct file *filp, int cmd, struct file_lock *fl, int is_local)
> */
> if (!is_local)
> status = NFS_PROTO(inode)->lock(filp, cmd, fl);
> + else if ((fl->fl_flags & FL_SLEEP) && IS_SETLK(cmd))
> + status = posix_lock_file(filp, fl, NULL);
> else
> status = locks_lock_file_wait(filp, fl);
> - if (status < 0)
> + if (status)
> goto out;
>
> /*
>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] nfs: local_lock: handle async processing of F_SETLK with FL_SLEEP
2021-12-27 10:45 [PATCH] nfs: local_lock: handle async processing of F_SETLK with FL_SLEEP Vasily Averin
2021-12-27 12:59 ` kernel test robot
@ 2022-01-06 10:29 ` Dan Carpenter
0 siblings, 0 replies; 8+ messages in thread
From: kernel test robot @ 2021-12-28 4:19 UTC (permalink / raw)
To: kbuild
[-- Attachment #1: Type: text/plain, Size: 4978 bytes --]
CC: kbuild-all(a)lists.01.org
In-Reply-To: <6613b17b-43bd-07d0-2ca7-1581a39cdf7b@virtuozzo.com>
References: <6613b17b-43bd-07d0-2ca7-1581a39cdf7b@virtuozzo.com>
TO: Vasily Averin <vvs@virtuozzo.com>
TO: Trond Myklebust <trond.myklebust@hammerspace.com>
TO: Anna Schumaker <anna.schumaker@netapp.com>
CC: kernel(a)openvz.org
CC: linux-nfs(a)vger.kernel.org
CC: linux-kernel(a)vger.kernel.org
Hi Vasily,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on trondmy-nfs/linux-next]
[also build test WARNING on v5.16-rc7 next-20211224]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Vasily-Averin/nfs-local_lock-handle-async-processing-of-F_SETLK-with-FL_SLEEP/20211227-184705
base: git://git.linux-nfs.org/projects/trondmy/linux-nfs.git linux-next
:::::: branch date: 17 hours ago
:::::: commit date: 17 hours ago
config: i386-randconfig-m021-20211227 (https://download.01.org/0day-ci/archive/20211228/202112281211.SsWl4cfI-lkp(a)intel.com/config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
smatch warnings:
fs/nfs/file.c:772 do_setlk() warn: should this be a bitwise op?
vim +772 fs/nfs/file.c
^1da177e4c3f41 Linus Torvalds 2005-04-16 751
5eebde23223aeb Suresh Jayaraman 2010-09-23 752 static int
5eebde23223aeb Suresh Jayaraman 2010-09-23 753 do_setlk(struct file *filp, int cmd, struct file_lock *fl, int is_local)
^1da177e4c3f41 Linus Torvalds 2005-04-16 754 {
^1da177e4c3f41 Linus Torvalds 2005-04-16 755 struct inode *inode = filp->f_mapping->host;
^1da177e4c3f41 Linus Torvalds 2005-04-16 756 int status;
^1da177e4c3f41 Linus Torvalds 2005-04-16 757
^1da177e4c3f41 Linus Torvalds 2005-04-16 758 /*
^1da177e4c3f41 Linus Torvalds 2005-04-16 759 * Flush all pending writes before doing anything
^1da177e4c3f41 Linus Torvalds 2005-04-16 760 * with locks..
^1da177e4c3f41 Linus Torvalds 2005-04-16 761 */
29884df0d89c1d Trond Myklebust 2005-12-13 762 status = nfs_sync_mapping(filp->f_mapping);
29884df0d89c1d Trond Myklebust 2005-12-13 763 if (status != 0)
^1da177e4c3f41 Linus Torvalds 2005-04-16 764 goto out;
^1da177e4c3f41 Linus Torvalds 2005-04-16 765
5eebde23223aeb Suresh Jayaraman 2010-09-23 766 /*
5eebde23223aeb Suresh Jayaraman 2010-09-23 767 * Use local locking if mounted with "-onolock" or with appropriate
5eebde23223aeb Suresh Jayaraman 2010-09-23 768 * "-olocal_lock="
5eebde23223aeb Suresh Jayaraman 2010-09-23 769 */
5eebde23223aeb Suresh Jayaraman 2010-09-23 770 if (!is_local)
^1da177e4c3f41 Linus Torvalds 2005-04-16 771 status = NFS_PROTO(inode)->lock(filp, cmd, fl);
00e7edbaaa914f Vasily Averin 2021-12-27 @772 else if ((fl->fl_flags && FL_SLEEP) && IS_SETLK(cmd))
00e7edbaaa914f Vasily Averin 2021-12-27 773 status = posix_lock_file(filp, fl, NULL);
c4d7c402b788b7 Trond Myklebust 2008-04-01 774 else
75575ddf29cbbf Jeff Layton 2016-09-17 775 status = locks_lock_file_wait(filp, fl);
00e7edbaaa914f Vasily Averin 2021-12-27 776 if (status)
^1da177e4c3f41 Linus Torvalds 2005-04-16 777 goto out;
6b96724e507fec Ricardo Labiaga 2010-10-12 778
^1da177e4c3f41 Linus Torvalds 2005-04-16 779 /*
779eafab06036f NeilBrown 2017-08-18 780 * Invalidate cache to prevent missing any changes. If
779eafab06036f NeilBrown 2017-08-18 781 * the file is mapped, clear the page cache as well so
779eafab06036f NeilBrown 2017-08-18 782 * those mappings will be loaded.
6b96724e507fec Ricardo Labiaga 2010-10-12 783 *
^1da177e4c3f41 Linus Torvalds 2005-04-16 784 * This makes locking act as a cache coherency point.
^1da177e4c3f41 Linus Torvalds 2005-04-16 785 */
29884df0d89c1d Trond Myklebust 2005-12-13 786 nfs_sync_mapping(filp->f_mapping);
779eafab06036f NeilBrown 2017-08-18 787 if (!NFS_PROTO(inode)->have_delegation(inode, FMODE_READ)) {
442ce0499c0535 NeilBrown 2017-07-24 788 nfs_zap_caches(inode);
779eafab06036f NeilBrown 2017-08-18 789 if (mapping_mapped(filp->f_mapping))
779eafab06036f NeilBrown 2017-08-18 790 nfs_revalidate_mapping(inode, filp->f_mapping);
779eafab06036f NeilBrown 2017-08-18 791 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 792 out:
^1da177e4c3f41 Linus Torvalds 2005-04-16 793 return status;
^1da177e4c3f41 Linus Torvalds 2005-04-16 794 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 795
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] nfs: local_lock: handle async processing of F_SETLK with FL_SLEEP
@ 2022-01-06 10:29 ` Dan Carpenter
0 siblings, 0 replies; 8+ messages in thread
From: Dan Carpenter @ 2022-01-06 10:29 UTC (permalink / raw)
To: kbuild, Vasily Averin, Trond Myklebust, Anna Schumaker
Cc: lkp, kbuild-all, kernel, linux-nfs, linux-kernel
Hi Vasily,
url: https://github.com/0day-ci/linux/commits/Vasily-Averin/nfs-local_lock-handle-async-processing-of-F_SETLK-with-FL_SLEEP/20211227-184705
base: git://git.linux-nfs.org/projects/trondmy/linux-nfs.git linux-next
config: i386-randconfig-m021-20211227 (https://download.01.org/0day-ci/archive/20211228/202112281211.SsWl4cfI-lkp@intel.com/config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
smatch warnings:
fs/nfs/file.c:772 do_setlk() warn: should this be a bitwise op?
vim +772 fs/nfs/file.c
5eebde23223aeb Suresh Jayaraman 2010-09-23 752 static int
5eebde23223aeb Suresh Jayaraman 2010-09-23 753 do_setlk(struct file *filp, int cmd, struct file_lock *fl, int is_local)
^1da177e4c3f41 Linus Torvalds 2005-04-16 754 {
^1da177e4c3f41 Linus Torvalds 2005-04-16 755 struct inode *inode = filp->f_mapping->host;
^1da177e4c3f41 Linus Torvalds 2005-04-16 756 int status;
^1da177e4c3f41 Linus Torvalds 2005-04-16 757
^1da177e4c3f41 Linus Torvalds 2005-04-16 758 /*
^1da177e4c3f41 Linus Torvalds 2005-04-16 759 * Flush all pending writes before doing anything
^1da177e4c3f41 Linus Torvalds 2005-04-16 760 * with locks..
^1da177e4c3f41 Linus Torvalds 2005-04-16 761 */
29884df0d89c1d Trond Myklebust 2005-12-13 762 status = nfs_sync_mapping(filp->f_mapping);
29884df0d89c1d Trond Myklebust 2005-12-13 763 if (status != 0)
^1da177e4c3f41 Linus Torvalds 2005-04-16 764 goto out;
^1da177e4c3f41 Linus Torvalds 2005-04-16 765
5eebde23223aeb Suresh Jayaraman 2010-09-23 766 /*
5eebde23223aeb Suresh Jayaraman 2010-09-23 767 * Use local locking if mounted with "-onolock" or with appropriate
5eebde23223aeb Suresh Jayaraman 2010-09-23 768 * "-olocal_lock="
5eebde23223aeb Suresh Jayaraman 2010-09-23 769 */
5eebde23223aeb Suresh Jayaraman 2010-09-23 770 if (!is_local)
^1da177e4c3f41 Linus Torvalds 2005-04-16 771 status = NFS_PROTO(inode)->lock(filp, cmd, fl);
00e7edbaaa914f Vasily Averin 2021-12-27 @772 else if ((fl->fl_flags && FL_SLEEP) && IS_SETLK(cmd))
^
&& vs &
00e7edbaaa914f Vasily Averin 2021-12-27 773 status = posix_lock_file(filp, fl, NULL);
c4d7c402b788b7 Trond Myklebust 2008-04-01 774 else
75575ddf29cbbf Jeff Layton 2016-09-17 775 status = locks_lock_file_wait(filp, fl);
00e7edbaaa914f Vasily Averin 2021-12-27 776 if (status)
^1da177e4c3f41 Linus Torvalds 2005-04-16 777 goto out;
6b96724e507fec Ricardo Labiaga 2010-10-12 778
^1da177e4c3f41 Linus Torvalds 2005-04-16 779 /*
779eafab06036f NeilBrown 2017-08-18 780 * Invalidate cache to prevent missing any changes. If
779eafab06036f NeilBrown 2017-08-18 781 * the file is mapped, clear the page cache as well so
779eafab06036f NeilBrown 2017-08-18 782 * those mappings will be loaded.
6b96724e507fec Ricardo Labiaga 2010-10-12 783 *
^1da177e4c3f41 Linus Torvalds 2005-04-16 784 * This makes locking act as a cache coherency point.
^1da177e4c3f41 Linus Torvalds 2005-04-16 785 */
29884df0d89c1d Trond Myklebust 2005-12-13 786 nfs_sync_mapping(filp->f_mapping);
779eafab06036f NeilBrown 2017-08-18 787 if (!NFS_PROTO(inode)->have_delegation(inode, FMODE_READ)) {
442ce0499c0535 NeilBrown 2017-07-24 788 nfs_zap_caches(inode);
779eafab06036f NeilBrown 2017-08-18 789 if (mapping_mapped(filp->f_mapping))
779eafab06036f NeilBrown 2017-08-18 790 nfs_revalidate_mapping(inode, filp->f_mapping);
779eafab06036f NeilBrown 2017-08-18 791 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 792 out:
^1da177e4c3f41 Linus Torvalds 2005-04-16 793 return status;
^1da177e4c3f41 Linus Torvalds 2005-04-16 794 }
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] nfs: local_lock: handle async processing of F_SETLK with FL_SLEEP
@ 2022-01-06 10:29 ` Dan Carpenter
0 siblings, 0 replies; 8+ messages in thread
From: Dan Carpenter @ 2022-01-06 10:29 UTC (permalink / raw)
To: kbuild-all
[-- Attachment #1: Type: text/plain, Size: 4145 bytes --]
Hi Vasily,
url: https://github.com/0day-ci/linux/commits/Vasily-Averin/nfs-local_lock-handle-async-processing-of-F_SETLK-with-FL_SLEEP/20211227-184705
base: git://git.linux-nfs.org/projects/trondmy/linux-nfs.git linux-next
config: i386-randconfig-m021-20211227 (https://download.01.org/0day-ci/archive/20211228/202112281211.SsWl4cfI-lkp(a)intel.com/config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
smatch warnings:
fs/nfs/file.c:772 do_setlk() warn: should this be a bitwise op?
vim +772 fs/nfs/file.c
5eebde23223aeb Suresh Jayaraman 2010-09-23 752 static int
5eebde23223aeb Suresh Jayaraman 2010-09-23 753 do_setlk(struct file *filp, int cmd, struct file_lock *fl, int is_local)
^1da177e4c3f41 Linus Torvalds 2005-04-16 754 {
^1da177e4c3f41 Linus Torvalds 2005-04-16 755 struct inode *inode = filp->f_mapping->host;
^1da177e4c3f41 Linus Torvalds 2005-04-16 756 int status;
^1da177e4c3f41 Linus Torvalds 2005-04-16 757
^1da177e4c3f41 Linus Torvalds 2005-04-16 758 /*
^1da177e4c3f41 Linus Torvalds 2005-04-16 759 * Flush all pending writes before doing anything
^1da177e4c3f41 Linus Torvalds 2005-04-16 760 * with locks..
^1da177e4c3f41 Linus Torvalds 2005-04-16 761 */
29884df0d89c1d Trond Myklebust 2005-12-13 762 status = nfs_sync_mapping(filp->f_mapping);
29884df0d89c1d Trond Myklebust 2005-12-13 763 if (status != 0)
^1da177e4c3f41 Linus Torvalds 2005-04-16 764 goto out;
^1da177e4c3f41 Linus Torvalds 2005-04-16 765
5eebde23223aeb Suresh Jayaraman 2010-09-23 766 /*
5eebde23223aeb Suresh Jayaraman 2010-09-23 767 * Use local locking if mounted with "-onolock" or with appropriate
5eebde23223aeb Suresh Jayaraman 2010-09-23 768 * "-olocal_lock="
5eebde23223aeb Suresh Jayaraman 2010-09-23 769 */
5eebde23223aeb Suresh Jayaraman 2010-09-23 770 if (!is_local)
^1da177e4c3f41 Linus Torvalds 2005-04-16 771 status = NFS_PROTO(inode)->lock(filp, cmd, fl);
00e7edbaaa914f Vasily Averin 2021-12-27 @772 else if ((fl->fl_flags && FL_SLEEP) && IS_SETLK(cmd))
^
&& vs &
00e7edbaaa914f Vasily Averin 2021-12-27 773 status = posix_lock_file(filp, fl, NULL);
c4d7c402b788b7 Trond Myklebust 2008-04-01 774 else
75575ddf29cbbf Jeff Layton 2016-09-17 775 status = locks_lock_file_wait(filp, fl);
00e7edbaaa914f Vasily Averin 2021-12-27 776 if (status)
^1da177e4c3f41 Linus Torvalds 2005-04-16 777 goto out;
6b96724e507fec Ricardo Labiaga 2010-10-12 778
^1da177e4c3f41 Linus Torvalds 2005-04-16 779 /*
779eafab06036f NeilBrown 2017-08-18 780 * Invalidate cache to prevent missing any changes. If
779eafab06036f NeilBrown 2017-08-18 781 * the file is mapped, clear the page cache as well so
779eafab06036f NeilBrown 2017-08-18 782 * those mappings will be loaded.
6b96724e507fec Ricardo Labiaga 2010-10-12 783 *
^1da177e4c3f41 Linus Torvalds 2005-04-16 784 * This makes locking act as a cache coherency point.
^1da177e4c3f41 Linus Torvalds 2005-04-16 785 */
29884df0d89c1d Trond Myklebust 2005-12-13 786 nfs_sync_mapping(filp->f_mapping);
779eafab06036f NeilBrown 2017-08-18 787 if (!NFS_PROTO(inode)->have_delegation(inode, FMODE_READ)) {
442ce0499c0535 NeilBrown 2017-07-24 788 nfs_zap_caches(inode);
779eafab06036f NeilBrown 2017-08-18 789 if (mapping_mapped(filp->f_mapping))
779eafab06036f NeilBrown 2017-08-18 790 nfs_revalidate_mapping(inode, filp->f_mapping);
779eafab06036f NeilBrown 2017-08-18 791 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 792 out:
^1da177e4c3f41 Linus Torvalds 2005-04-16 793 return status;
^1da177e4c3f41 Linus Torvalds 2005-04-16 794 }
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2022-01-06 10:30 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-27 10:45 [PATCH] nfs: local_lock: handle async processing of F_SETLK with FL_SLEEP Vasily Averin
2021-12-27 12:59 ` kernel test robot
2021-12-27 12:59 ` kernel test robot
2021-12-27 15:50 ` [PATCH v2] " Vasily Averin
2021-12-28 1:00 ` Vasily Averin
-- strict thread matches above, loose matches on Subject: below --
2021-12-28 4:19 [PATCH] " kernel test robot
2022-01-06 10:29 ` Dan Carpenter
2022-01-06 10:29 ` Dan Carpenter
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.