Re: [PATCH v3 2/2] fs: remove mandatory file locking support

From: Al Viro
Date: Fri Aug 20 2021 - 15:45:41 EST


On Fri, Aug 20, 2021 at 12:39:19PM -0400, Jeff Layton wrote:

> diff --git a/fs/locks.c b/fs/locks.c

> @@ -2857,8 +2744,7 @@ static void lock_get_status(struct seq_file *f, struct file_lock *fl,
> seq_puts(f, "POSIX ");
>
> seq_printf(f, " %s ",
> - (inode == NULL) ? "*NOINODE*" :
> - mandatory_lock(inode) ? "MANDATORY" : "ADVISORY ");
> + (inode == NULL) ? "*NOINODE*" : "ADVISORY ");

Huh?

<looks>
if (fl->fl_file != NULL)
inode = locks_inode(fl->fl_file);

So basically that's fl->fl_file ? "ADVISORY" : "*NOINODE*"?

How could that trigger, though? With locks_mandatory_area() gone, I don't
see how FL_POSIX file_lock with NULL ->fl_file could be ever found...
Confused...

Why is locks_copy_conflock() exported (hell, non-static), BTW?

> diff --git a/fs/namespace.c b/fs/namespace.c


> -#ifdef CONFIG_MANDATORY_FILE_LOCKING
> -static bool may_mandlock(void)
> +static void warn_mandlock(void)
> {
> - pr_warn_once("======================================================\n"
> - "WARNING: the mand mount option is being deprecated and\n"
> - " will be removed in v5.15!\n"
> - "======================================================\n");
> - return capable(CAP_SYS_ADMIN);
> + pr_warn_once("=======================================================\n"
> + "WARNING: The mand mount option has been deprecated and\n"
> + " and is ignored by this kernel. Remove the mand\n"
> + " option from the mount to silence this warning.\n"
> + "=======================================================\n");
> }
> -#else
> -static inline bool may_mandlock(void)
> -{
> - pr_warn("VFS: \"mand\" mount option not supported");
> - return false;
> -}
> -#endif

Is there any point in having the previous patch not folded into this one?