2004-03-21 10:31:14

by Frank Cusack

[permalink] [raw]
Subject: Does Linux sync(2) wait?

Looking at 2.4 and 2.6 sources, Linux does appear to wait before returning.
I'm especially interested if NFS data is sent to the server. (I want to
be able to take a stable snapshot of a netapp volume.)

But on my RHL 9 system, I have 3 different man pages and an info page,
all of which say something different.

sync(2) says:

According to the standard specification (e.g., SVID), sync() schedules
the writes, but may return before the actual writing is done. However,
since version 1.3.20 Linux does actually wait.

sync(8) says:

On Linux, sync is only guaranteed to schedule the dirty blocks for
writing; it can actually take a short time before all the blocks are
finally written.

sync(1) is in the middle and doesn't really say anything, it refers to
the info page which also isn't specific.

/fc


2004-03-21 15:31:03

by Pascal Schmidt

[permalink] [raw]
Subject: Re: Does Linux sync(2) wait?

On Sun, 21 Mar 2004 11:40:08 +0100, you wrote in linux.kernel:
> Looking at 2.4 and 2.6 sources, Linux does appear to wait before returning.
> I'm especially interested if NFS data is sent to the server. (I want to
> be able to take a stable snapshot of a netapp volume.)

No idea about NFS, but sync(1) does wait. When I push 500M out to my
MO drive, the cp operation returns fairly quickly because I usually
have more than 500M free memory. Then I run sync(1), which takes about
20 minutes before it returns.

--
Ciao,
Pascal

2004-03-22 00:59:55

by Chris Wedgwood

[permalink] [raw]
Subject: Re: Does Linux sync(2) wait?

On Sun, Mar 21, 2004 at 04:30:53PM +0100, Pascal Schmidt wrote:

> No idea about NFS, but sync(1) does wait. When I push 500M out to my
> MO drive, the cp operation returns fairly quickly because I usually
> have more than 500M free memory. Then I run sync(1), which takes
> about 20 minutes before it returns.

20 minutes?!


2004-03-22 03:44:42

by Chris Friesen

[permalink] [raw]
Subject: Re: Does Linux sync(2) wait?

Chris Wedgwood wrote:
> On Sun, Mar 21, 2004 at 04:30:53PM +0100, Pascal Schmidt wrote:
>
>
>>No idea about NFS, but sync(1) does wait. When I push 500M out to my
>>MO drive, the cp operation returns fairly quickly because I usually
>>have more than 500M free memory. Then I run sync(1), which takes
>>about 20 minutes before it returns.
>>
>
> 20 minutes?!

He did say it was a magneto-optical drive.

Chris


2004-03-22 12:09:12

by Stefan Smietanowski

[permalink] [raw]
Subject: Re: Does Linux sync(2) wait?

Hi.

>>> No idea about NFS, but sync(1) does wait. When I push 500M out to my
>>> MO drive, the cp operation returns fairly quickly because I usually
>>> have more than 500M free memory. Then I run sync(1), which takes
>>> about 20 minutes before it returns.
>>>
>>
>> 20 minutes?!
>
>
> He did say it was a magneto-optical drive.

That's 400KiB/s you know - pretty slow.

// Stefan

2004-03-22 14:27:56

by Pascal Schmidt

[permalink] [raw]
Subject: Re: Does Linux sync(2) wait?

On Mon, 22 Mar 2004, Stefan Smietanowski wrote:

> >> 20 minutes?!
> > He did say it was a magneto-optical drive.
> That's 400KiB/s you know - pretty slow.

Yes. It's almost exclusively used once per week for backup purposes.
Speed doesn't matter for that (about 400 MB of often changing data on
/home), reliability counts.

Data that doesn't really change (old kernel releases and such) is
also on MO, but that's "write once, than forget about it", so once
again speed doesn't matter that much.

--
Ciao,
Pascal