diff options
author | Mikulas Patocka <mpatocka@redhat.com> | 2014-10-16 14:45:20 -0400 |
---|---|---|
committer | Mike Snitzer <snitzer@redhat.com> | 2014-10-17 01:40:23 -0400 |
commit | 9d28eb12447ee08bb5d1e8bb3195cf20e1ecd1c0 (patch) | |
tree | 24ece98c42840d5b51a1a1f5d520f6a41dd60c0c /drivers/md/dm-bufio.c | |
parent | a3f2af2547884e02f7e43f995a6c442a4e54f1ea (diff) |
dm bufio: change __GFP_IO to __GFP_FS in shrinker callbacks
The shrinker uses gfp flags to indicate what kind of operation can the
driver wait for. If __GFP_IO flag is present, the driver can wait for
block I/O operations, if __GFP_FS flag is present, the driver can wait on
operations involving the filesystem.
dm-bufio tested for __GFP_IO. However, dm-bufio can run on a loop block
device that makes calls into the filesystem. If __GFP_IO is present and
__GFP_FS isn't, dm-bufio could still block on filesystem operations if it
runs on a loop block device.
The change from __GFP_IO to __GFP_FS supposedly fixes one observed (though
unreproducible) deadlock involving dm-bufio and loop device.
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Cc: stable@vger.kernel.org
Diffstat (limited to 'drivers/md/dm-bufio.c')
-rw-r--r-- | drivers/md/dm-bufio.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/drivers/md/dm-bufio.c b/drivers/md/dm-bufio.c index 9ea5b6041eb2..0be200b6dbf2 100644 --- a/drivers/md/dm-bufio.c +++ b/drivers/md/dm-bufio.c | |||
@@ -1435,9 +1435,9 @@ static void drop_buffers(struct dm_bufio_client *c) | |||
1435 | 1435 | ||
1436 | /* | 1436 | /* |
1437 | * Test if the buffer is unused and too old, and commit it. | 1437 | * Test if the buffer is unused and too old, and commit it. |
1438 | * At if noio is set, we must not do any I/O because we hold | 1438 | * And if GFP_NOFS is used, we must not do any I/O because we hold |
1439 | * dm_bufio_clients_lock and we would risk deadlock if the I/O gets rerouted to | 1439 | * dm_bufio_clients_lock and we would risk deadlock if the I/O gets |
1440 | * different bufio client. | 1440 | * rerouted to different bufio client. |
1441 | */ | 1441 | */ |
1442 | static int __cleanup_old_buffer(struct dm_buffer *b, gfp_t gfp, | 1442 | static int __cleanup_old_buffer(struct dm_buffer *b, gfp_t gfp, |
1443 | unsigned long max_jiffies) | 1443 | unsigned long max_jiffies) |
@@ -1445,7 +1445,7 @@ static int __cleanup_old_buffer(struct dm_buffer *b, gfp_t gfp, | |||
1445 | if (jiffies - b->last_accessed < max_jiffies) | 1445 | if (jiffies - b->last_accessed < max_jiffies) |
1446 | return 0; | 1446 | return 0; |
1447 | 1447 | ||
1448 | if (!(gfp & __GFP_IO)) { | 1448 | if (!(gfp & __GFP_FS)) { |
1449 | if (test_bit(B_READING, &b->state) || | 1449 | if (test_bit(B_READING, &b->state) || |
1450 | test_bit(B_WRITING, &b->state) || | 1450 | test_bit(B_WRITING, &b->state) || |
1451 | test_bit(B_DIRTY, &b->state)) | 1451 | test_bit(B_DIRTY, &b->state)) |
@@ -1487,7 +1487,7 @@ dm_bufio_shrink_scan(struct shrinker *shrink, struct shrink_control *sc) | |||
1487 | unsigned long freed; | 1487 | unsigned long freed; |
1488 | 1488 | ||
1489 | c = container_of(shrink, struct dm_bufio_client, shrinker); | 1489 | c = container_of(shrink, struct dm_bufio_client, shrinker); |
1490 | if (sc->gfp_mask & __GFP_IO) | 1490 | if (sc->gfp_mask & __GFP_FS) |
1491 | dm_bufio_lock(c); | 1491 | dm_bufio_lock(c); |
1492 | else if (!dm_bufio_trylock(c)) | 1492 | else if (!dm_bufio_trylock(c)) |
1493 | return SHRINK_STOP; | 1493 | return SHRINK_STOP; |
@@ -1504,7 +1504,7 @@ dm_bufio_shrink_count(struct shrinker *shrink, struct shrink_control *sc) | |||
1504 | unsigned long count; | 1504 | unsigned long count; |
1505 | 1505 | ||
1506 | c = container_of(shrink, struct dm_bufio_client, shrinker); | 1506 | c = container_of(shrink, struct dm_bufio_client, shrinker); |
1507 | if (sc->gfp_mask & __GFP_IO) | 1507 | if (sc->gfp_mask & __GFP_FS) |
1508 | dm_bufio_lock(c); | 1508 | dm_bufio_lock(c); |
1509 | else if (!dm_bufio_trylock(c)) | 1509 | else if (!dm_bufio_trylock(c)) |
1510 | return 0; | 1510 | return 0; |