Commit e046f3ddf3568776755e165baffb8067125511dc
Committed by
Greg Kroah-Hartman
1 parent
6ab11bbf0e
dm thin: don't allow messages to be sent to a pool target in READ_ONLY or FAIL mode
commit 2a7eaea02b99b6e267b1e89c79acc6e9a51cee3b upstream. You can't modify the metadata in these modes. It's better to fail these messages immediately than let the block-manager deny write locks on metadata blocks. Otherwise these failed metadata changes will trigger 'needs_check' to get set in the metadata superblock -- requiring repair using the thin_check utility. Signed-off-by: Joe Thornber <ejt@redhat.com> Signed-off-by: Mike Snitzer <snitzer@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Showing 1 changed file with 6 additions and 0 deletions Side-by-side Diff
drivers/md/dm-thin.c
... | ... | @@ -2978,6 +2978,12 @@ |
2978 | 2978 | struct pool_c *pt = ti->private; |
2979 | 2979 | struct pool *pool = pt->pool; |
2980 | 2980 | |
2981 | + if (get_pool_mode(pool) >= PM_READ_ONLY) { | |
2982 | + DMERR("%s: unable to service pool target messages in READ_ONLY or FAIL mode", | |
2983 | + dm_device_name(pool->pool_md)); | |
2984 | + return -EINVAL; | |
2985 | + } | |
2986 | + | |
2981 | 2987 | if (!strcasecmp(argv[0], "create_thin")) |
2982 | 2988 | r = process_create_thin_mesg(argc, argv, pool); |
2983 | 2989 |