Re: [PATCH] loop: Update mtime when writing using aops

Previous thread: [PATCH] slab: fix caller tracking on !CONFIG_DEBUG_SLAB && CONFIG_TRACING by Xiaotian Feng on Thursday, April 8, 2010 - 3:11 am. (7 messages)

Next thread: [PATCH 2.6.33.2 1/1] hid: add support for cymotion master solar keyboard by =?UTF-8?B?UmFwaGHDq2wgRG91cnNlbmF1ZA==?= on Thursday, April 8, 2010 - 3:58 am. (2 messages)
From: Nikanth Karthikesan
Date: Thursday, April 8, 2010 - 3:21 am

Update mtime when writing to backing filesystem using the address space
operations write_begin and write_end.

Signed-off-by: Nikanth Karthikesan <knikanth@suse.de>

---

diff --git a/drivers/block/loop.c b/drivers/block/loop.c
index cb69929..8546d12 100644
--- a/drivers/block/loop.c
+++ b/drivers/block/loop.c
@@ -237,6 +237,8 @@ static int do_lo_send_aops(struct loop_device *lo, struct bio_vec *bvec,
 		if (ret)
 			goto fail;
 
+		file_update_time(file);
+
 		transfer_result = lo_do_transfer(lo, WRITE, page, offset,
 				bvec->bv_page, bv_offs, size, IV);
 		copied = size;
--

From: Jens Axboe
Date: Thursday, April 8, 2010 - 5:45 am

You forgot to include a 'why' :-)

Not that I disagree with the patch, just curious what made you make the
change.

-- 
Jens Axboe

--

From: Tvrtko Ursulin
Date: Thursday, April 8, 2010 - 7:15 am

You mean how the bug was found? I originally reported this problem against
openSUSE 11.2 kernel, where when you have a dm-crypt loop filesystem the
container file modification time does not get updated with use. Consequence
of that is that backup runs would miss the fact container has changed.

Maybe one could argue it is a security feature in this scenario :), but as the
problem turns out to be unrelated to the crypto case, rather contained in the
loop driver itself, it looks like that would not hold.

Tvrtko

Sophos Plc, The Pentagon, Abingdon Science Park, Abingdon, OX14 3YP, United Kingdom.
Company Reg No 2096520. VAT Reg No GB 348 3873 20.
--

From: Jens Axboe
Date: Thursday, April 8, 2010 - 12:38 pm

I suppose you could update the mtime on tear down, since then it would
also be safe to actually backup. But same difference in the end I
suppose, I'll add the patch.

-- 
Jens Axboe

--

From: Nikanth Karthikesan
Date: Thursday, April 8, 2010 - 10:22 pm

If we update mtime only during tear down, we might miss to backup after a 
system crash or scenarios where the loop device is not deleted after use 
during backup. Also when relatime is used, it is better to change mtime on 
time. :-)

Thanks for taking the patch.

Thanks
Nikanth
--

Previous thread: [PATCH] slab: fix caller tracking on !CONFIG_DEBUG_SLAB && CONFIG_TRACING by Xiaotian Feng on Thursday, April 8, 2010 - 3:11 am. (7 messages)

Next thread: [PATCH 2.6.33.2 1/1] hid: add support for cymotion master solar keyboard by =?UTF-8?B?UmFwaGHDq2wgRG91cnNlbmF1ZA==?= on Thursday, April 8, 2010 - 3:58 am. (2 messages)