diff mbox series

[3/6] xfs: Block writes to log device

Message ID 20230704125702.23180-3-jack@suse.cz (mailing list archive)
State Superseded, archived
Headers show
Series block: Add config option to not allow writing to mounted devices | expand

Commit Message

Jan Kara July 4, 2023, 12:56 p.m. UTC
Ask block layer to not allow other writers to open block device used
for xfs log.

Signed-off-by: Jan Kara <jack@suse.cz>
---
 fs/xfs/xfs_super.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Comments

Darrick J. Wong July 4, 2023, 3:53 p.m. UTC | #1
On Tue, Jul 04, 2023 at 02:56:51PM +0200, Jan Kara wrote:
> Ask block layer to not allow other writers to open block device used
> for xfs log.

"...for the xfs log and realtime devices."

With that fixed,
Reviewed-by: Darrick J. Wong <djwong@kernel.org>

--D


> Signed-off-by: Jan Kara <jack@suse.cz>
> ---
>  fs/xfs/xfs_super.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c
> index b0fbf8ea7846..3808b4507552 100644
> --- a/fs/xfs/xfs_super.c
> +++ b/fs/xfs/xfs_super.c
> @@ -396,8 +396,9 @@ xfs_blkdev_get(
>  {
>  	int			error = 0;
>  
> -	*handlep = blkdev_get_by_path(name, BLK_OPEN_READ | BLK_OPEN_WRITE,
> -				      mp, &xfs_holder_ops);
> +	*handlep = blkdev_get_by_path(name,
> +			BLK_OPEN_READ | BLK_OPEN_WRITE | BLK_OPEN_BLOCK_WRITES,
> +			mp, &xfs_holder_ops);
>  	if (IS_ERR(*handlep)) {
>  		error = PTR_ERR(*handlep);
>  		xfs_warn(mp, "Invalid device [%s], error=%d", name, error);
> -- 
> 2.35.3
>
Jan Kara July 5, 2023, 10:31 a.m. UTC | #2
On Tue 04-07-23 08:53:13, Darrick J. Wong wrote:
> On Tue, Jul 04, 2023 at 02:56:51PM +0200, Jan Kara wrote:
> > Ask block layer to not allow other writers to open block device used
> > for xfs log.
> 
> "...for the xfs log and realtime devices."
> 
> With that fixed,
> Reviewed-by: Darrick J. Wong <djwong@kernel.org>

Thanks for the fixup and the review!

								Honza
diff mbox series

Patch

diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c
index b0fbf8ea7846..3808b4507552 100644
--- a/fs/xfs/xfs_super.c
+++ b/fs/xfs/xfs_super.c
@@ -396,8 +396,9 @@  xfs_blkdev_get(
 {
 	int			error = 0;
 
-	*handlep = blkdev_get_by_path(name, BLK_OPEN_READ | BLK_OPEN_WRITE,
-				      mp, &xfs_holder_ops);
+	*handlep = blkdev_get_by_path(name,
+			BLK_OPEN_READ | BLK_OPEN_WRITE | BLK_OPEN_BLOCK_WRITES,
+			mp, &xfs_holder_ops);
 	if (IS_ERR(*handlep)) {
 		error = PTR_ERR(*handlep);
 		xfs_warn(mp, "Invalid device [%s], error=%d", name, error);