[Cluster-devel] [PATCH] gfs2: fix overread in the strlcpy of init_names

2022-06-28 Thread Dongliang Mu
From: Dongliang Mu In init_names, strlcpy will overread the src string as the src string is less than GFS2_FSNAME_LEN(256). Fix this by modifying strlcpy back to snprintf, reverting the commit 00377d8e3842. Fixes: 00377d8e3842 ("[GFS2] Prefer strlcpy() over snprintf()") Reported-by: syzkaller

Re: [Cluster-devel] sparse warnings related to kref_put_lock() and refcount_dec_and_lock()

2022-06-28 Thread Luc Van Oostenryck
On Mon, Jun 27, 2022 at 09:06:43PM -0400, Alexander Aring wrote: > > > > If we change the refcount code to _never_ calling unlock() for the > > specific lock, then all those foo_and_lock_bar() functions can be > > annotated with "__acquires()". This should also end in the same code? > > sorry, thi

Re: [Cluster-devel] [PATCH] gfs2: fix overread in the strlcpy of init_names

2022-06-28 Thread Andreas Gruenbacher
Dongliang Mu, On Tue, Jun 28, 2022 at 8:10 AM Dongliang Mu wrote: > From: Dongliang Mu > > In init_names, strlcpy will overread the src string as the src string is > less than GFS2_FSNAME_LEN(256). > > Fix this by modifying strlcpy back to snprintf, reverting > the commit 00377d8e3842. ... if t

Re: [Cluster-devel] sparse warnings related to kref_put_lock() and refcount_dec_and_lock()

2022-06-28 Thread Alexander Aring
Hi Luc, On Tue, Jun 28, 2022 at 4:58 AM Luc Van Oostenryck wrote: > > On Mon, Jun 27, 2022 at 09:06:43PM -0400, Alexander Aring wrote: > > > > > > If we change the refcount code to _never_ calling unlock() for the > > > specific lock, then all those foo_and_lock_bar() functions can be > > > annot

Re: [Cluster-devel] sparse warnings related to kref_put_lock() and refcount_dec_and_lock()

2022-06-28 Thread Linus Torvalds
On Tue, Jun 28, 2022 at 1:58 AM Luc Van Oostenryck wrote: > > I would certainly not recommend this but ... > if it's OK to cheat and lie then you can do: > + bool refcount_dec_and_lock(refcount_t *r, spinlock_t *lock) > __acquires(lock); Actually, we have "__cond_lock()" in the kernel to a

[Cluster-devel] [PATCH] gfs2: Minor gfs2_glock_nq_m cleanup

2022-06-28 Thread Andreas Gruenbacher
Add state and flags arguments to gfs2_rlist_alloc() to make it somewhat more obvious which state and flags an rlist uses. With that, stop knocking off flags in gfs2_glock_nq_m() and its nq_m_sync() helper that are never set in the first place. Signed-off-by: Andreas Gruenbacher --- fs/gfs2/dir.

[Cluster-devel] [PATCH] gfs2: Minor gfs2_glock_nq_m cleanup

2022-06-28 Thread Andreas Gruenbacher
Add state and flags arguments to gfs2_rlist_alloc() to make it somewhat more obvious which state and flags an rlist uses. With that, stop knocking off flags in gfs2_glock_nq_m() and its nq_m_sync() helper that are never set in the first place. Signed-off-by: Andreas Gruenbacher --- fs/gfs2/dir.

[Cluster-devel] [PATCH 2/5] gfs2: Add flocks to glockfd debugfs file

2022-06-28 Thread Andreas Gruenbacher
Include flock glocks in the "glockfd" debugfs file. Those are similar to the iopen glocks; while an open file is holding an flock, it is holding the file's flock glock. We cannot take f_fl_mutex in gfs2_glockfd_seq_show_flock() or else dumping the "glockfd" file would block on flock operations.

[Cluster-devel] [PATCH 5/5] gfs2: Mark the remaining process-independent glock holders as GL_NOPID

2022-06-28 Thread Andreas Gruenbacher
Add the GL_NOPID flag for the remaining glock holders which are not associated with the current process. Signed-off-by: Andreas Gruenbacher --- fs/gfs2/inode.c | 6 -- fs/gfs2/ops_fstype.c | 14 -- fs/gfs2/super.c | 3 ++- fs/gfs2/util.c | 6 -- 4 files cha

[Cluster-devel] [PATCH 0/5] gfs2: debugfs PID reporting improvements

2022-06-28 Thread Andreas Gruenbacher
Currently, all glock holders in the "glocks" dump file are reported as being associated with the process that acquired them, even for holders that are actually associated with the filesystem itself (like the journal glock holder) or with cached inodes (like iopen and flock glock holders). This is

[Cluster-devel] [PATCH 4/5] gfs2: Mark flock glock holders as GL_NOPID

2022-06-28 Thread Andreas Gruenbacher
Add the GL_NOPID flag for flock glock holders. Clean up the flag setting code in do_flock. Signed-off-by: Andreas Gruenbacher --- fs/gfs2/file.c | 7 +-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/fs/gfs2/file.c b/fs/gfs2/file.c index 25f4080bc973..1383f9598011 100644 ---

[Cluster-devel] [PATCH 3/5] gfs2: Add GL_NOPID flag for process-independent glock holders

2022-06-28 Thread Andreas Gruenbacher
Add a GL_NOPID flag to indicate that once a glock holder has been acquired, it won't be associated with the current process anymore. This is useful for iopen and flock glocks which are associated with open files, as well as journal glock holders and similar which are associated with the filesystem

[Cluster-devel] [PATCH 1/5] gfs2: Add glockfd debugfs file

2022-06-28 Thread Andreas Gruenbacher
When a process has a gfs2 file open, the file is keeping a reference on the underlying gfs2 inode, and the inode is keeping the inode's iopen glock held in shared mode. In other words, the process depends on the iopen glock of each open gfs2 file. Expose those dependencies in a new "glockfd" debu

[Cluster-devel] [gfs2:nopid 1/5] fs/gfs2/glock.c:2759:36: warning: initialization of 'struct pid_namespace *' from 'int' makes pointer from integer without a cast

2022-06-28 Thread kernel test robot
tree: https://git.kernel.org/pub/scm/linux/kernel/git/gfs2/linux-gfs2.git nopid head: b1d0ed94e881ca5b5aee15e05f13db75445398f2 commit: 13ba8572506201aa85020970f776597fbcdcda56 [1/5] gfs2: Add glockfd debugfs file config: csky-randconfig-r025-20220627 (https://download.01.org/0day-ci/archive/

[Cluster-devel] [gfs2:nopid 1/5] fs/gfs2/glock.c:2785:3: error: call to undeclared function 'fput'; ISO C99 and later do not support implicit function declarations

2022-06-28 Thread kernel test robot
tree: https://git.kernel.org/pub/scm/linux/kernel/git/gfs2/linux-gfs2.git nopid head: b1d0ed94e881ca5b5aee15e05f13db75445398f2 commit: 13ba8572506201aa85020970f776597fbcdcda56 [1/5] gfs2: Add glockfd debugfs file config: arm64-buildonly-randconfig-r005-20220627 (https://download.01.org/0day-

[Cluster-devel] [gfs2:nopid 1/5] fs/gfs2/glock.c:2759:36: error: implicit declaration of function 'task_active_pid_ns'

2022-06-28 Thread kernel test robot
tree: https://git.kernel.org/pub/scm/linux/kernel/git/gfs2/linux-gfs2.git nopid head: b1d0ed94e881ca5b5aee15e05f13db75445398f2 commit: 13ba8572506201aa85020970f776597fbcdcda56 [1/5] gfs2: Add glockfd debugfs file config: csky-randconfig-r025-20220627 (https://download.01.org/0day-ci/archive/