lkml.org 
[lkml]   [2011]   [May]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [rfc] Ignore Fsync Calls in Laptop_Mode
On Thu, May 19, 2011 at 3:43 PM, Alan Cox <alan@lxorguk.ukuu.org.uk> wrote:
>> Problem: laptop_mode wants to keep applications from waking the hard
>> disks but fsync calls can "sneak through". (IMHO this is a bug.)
>
> Its a standards requirement and thing many apps rely on. Also you can do
> it perfectly well in user space for all apps. Thats why you can
> preconfigure preloads and it's why you have glic library source code!

Yes, it's another possibility I've considered. So then the patch
should go into glibc and glibc check for active laptop_mode? But if
implement it inside a library won't I get the same ordering guarantee
failure?
>
>> Proposed solution: Pretend the fsync was executed and successful.
>> Insert two lines into the fsync and fdatasync calls in fs/sync.c:
>> if (unlikely(laptop_mode))
>> return 0;
>
> Whoops you've just risked corrupting any app which relies on fsync for
> ordering if there is a crash.
(...)
> The "right" way to do this is more complicated by far. An fsync is an
> ordering guarantee so you need to implement that ordering guarantee even
> if you don't force writes to physical media.

Ok. No problem, so the exit point would be a different one.

> That at least cuts down most failures (but not all - eg commits with a network
> component such as email receives)

I don't understand your email example.


\
 
 \ /
  Last update: 2011-05-19 17:05    [from the cache]
©2003-2014 Jasper Spaans. Advertise on this site