All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] loop: Update mtime when writing using aops
@ 2010-04-08 10:21 Nikanth Karthikesan
  2010-04-08 12:45 ` Jens Axboe
  0 siblings, 1 reply; 5+ messages in thread
From: Nikanth Karthikesan @ 2010-04-08 10:21 UTC (permalink / raw)
  To: Jens Axboe; +Cc: linux-kernel

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;

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] loop: Update mtime when writing using aops
  2010-04-08 10:21 [PATCH] loop: Update mtime when writing using aops Nikanth Karthikesan
@ 2010-04-08 12:45 ` Jens Axboe
  2010-04-08 14:15   ` Tvrtko Ursulin
  0 siblings, 1 reply; 5+ messages in thread
From: Jens Axboe @ 2010-04-08 12:45 UTC (permalink / raw)
  To: Nikanth Karthikesan; +Cc: linux-kernel

On Thu, Apr 08 2010, Nikanth Karthikesan wrote:
> Update mtime when writing to backing filesystem using the address space
> operations write_begin and write_end.

You forgot to include a 'why' :-)

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

-- 
Jens Axboe


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] loop: Update mtime when writing using aops
  2010-04-08 12:45 ` Jens Axboe
@ 2010-04-08 14:15   ` Tvrtko Ursulin
  2010-04-08 19:38     ` Jens Axboe
  0 siblings, 1 reply; 5+ messages in thread
From: Tvrtko Ursulin @ 2010-04-08 14:15 UTC (permalink / raw)
  To: Jens Axboe; +Cc: Nikanth Karthikesan, linux-kernel

On Thursday 08 April 2010 13:45:39 Jens Axboe wrote:
> On Thu, Apr 08 2010, Nikanth Karthikesan wrote:
> > Update mtime when writing to backing filesystem using the address space
> > operations write_begin and write_end.
>
> You forgot to include a 'why' :-)
>
> Not that I disagree with the patch, just curious what made you make the
> change.

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.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] loop: Update mtime when writing using aops
  2010-04-08 14:15   ` Tvrtko Ursulin
@ 2010-04-08 19:38     ` Jens Axboe
  2010-04-09  5:22       ` Nikanth Karthikesan
  0 siblings, 1 reply; 5+ messages in thread
From: Jens Axboe @ 2010-04-08 19:38 UTC (permalink / raw)
  To: Tvrtko Ursulin; +Cc: Nikanth Karthikesan, linux-kernel

On Thu, Apr 08 2010, Tvrtko Ursulin wrote:
> On Thursday 08 April 2010 13:45:39 Jens Axboe wrote:
> > On Thu, Apr 08 2010, Nikanth Karthikesan wrote:
> > > Update mtime when writing to backing filesystem using the address space
> > > operations write_begin and write_end.
> >
> > You forgot to include a 'why' :-)
> >
> > Not that I disagree with the patch, just curious what made you make the
> > change.
> 
> 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.

:-)

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


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] loop: Update mtime when writing using aops
  2010-04-08 19:38     ` Jens Axboe
@ 2010-04-09  5:22       ` Nikanth Karthikesan
  0 siblings, 0 replies; 5+ messages in thread
From: Nikanth Karthikesan @ 2010-04-09  5:22 UTC (permalink / raw)
  To: Jens Axboe; +Cc: Tvrtko Ursulin, linux-kernel

On Friday 09 April 2010 01:08:38 Jens Axboe wrote:
> On Thu, Apr 08 2010, Tvrtko Ursulin wrote:
> > On Thursday 08 April 2010 13:45:39 Jens Axboe wrote:
> > > On Thu, Apr 08 2010, Nikanth Karthikesan wrote:
> > > > Update mtime when writing to backing filesystem using the address
> > > > space operations write_begin and write_end.
> > >
> > > You forgot to include a 'why' :-)
> > >
> > > Not that I disagree with the patch, just curious what made you make the
> > > change.
> >

Sorry, for the bad terse changelog.

> > 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.
> >
> :-)
> 
> 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.
> 

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2010-04-09  5:21 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-04-08 10:21 [PATCH] loop: Update mtime when writing using aops Nikanth Karthikesan
2010-04-08 12:45 ` Jens Axboe
2010-04-08 14:15   ` Tvrtko Ursulin
2010-04-08 19:38     ` Jens Axboe
2010-04-09  5:22       ` Nikanth Karthikesan

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.