diff options
author | Jeff Layton <jlayton@kernel.org> | 2019-08-15 15:21:17 -0400 |
---|---|---|
committer | Sasha Levin <sashal@kernel.org> | 2021-08-26 08:36:49 -0400 |
commit | 3cab951cf059bd6854c3b796f6df928f0c78224c (patch) | |
tree | 0637f7b0495b122c41e3d4f1aacab823931d52ec /fs | |
parent | c764cf4c8f93485e38048c91d5c935a3f817f6e2 (diff) |
locks: print a warning when mount fails due to lack of "mand" support
[ Upstream commit df2474a22c42ce419b67067c52d71da06c385501 ]
Since 9e8925b67a ("locks: Allow disabling mandatory locking at compile
time"), attempts to mount filesystems with "-o mand" will fail.
Unfortunately, there is no other indiciation of the reason for the
failure.
Change how the function is defined for better readability. When
CONFIG_MANDATORY_FILE_LOCKING is disabled, printk a warning when
someone attempts to mount with -o mand.
Also, add a blurb to the mandatory-locking.txt file to explain about
the "mand" option, and the behavior one should expect when it is
disabled.
Reported-by: Jan Kara <jack@suse.cz>
Reviewed-by: Jan Kara <jack@suse.cz>
Signed-off-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/namespace.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/fs/namespace.c b/fs/namespace.c index edd397fa2991..8d2bf350e7c6 100644 --- a/fs/namespace.c +++ b/fs/namespace.c @@ -1610,13 +1610,18 @@ static inline bool may_mount(void) return ns_capable(current->nsproxy->mnt_ns->user_ns, CAP_SYS_ADMIN); } +#ifdef CONFIG_MANDATORY_FILE_LOCKING static inline bool may_mandlock(void) { -#ifndef CONFIG_MANDATORY_FILE_LOCKING - return false; -#endif return capable(CAP_SYS_ADMIN); } +#else +static inline bool may_mandlock(void) +{ + pr_warn("VFS: \"mand\" mount option not supported"); + return false; +} +#endif /* * Now umount can handle mount points as well as block devices. |