2012-03-05 18:17:43

by DENIEL Philippe

[permalink] [raw]
Subject: How does the client manage NFS3ERR_NOSPC ?

Hi List,

I ran a stupid test (using the kernel's knfsd) : I filled up completely
a filesystem with a few big file. When it was 100% full (no free block
at all), I ran a dd on it.
The dd said it could write 793 blocks of size 1mb and failed on IO
error. At the end, I could see an empty file in the NFS exported tree.
Question is :
- why did I get EIO and not ENOSPC ?
- why did dd say "hey, I could write 793 blocks" when it wrote
nothing (and could not write anything).
Do you have an idea on that ?

Regards

Philippe


2012-03-05 21:01:24

by Myklebust, Trond

[permalink] [raw]
Subject: Re: How does the client manage NFS3ERR_NOSPC ?

T24gTW9uLCAyMDEyLTAzLTA1IGF0IDE4OjE2ICswMTAwLCBERU5JRUwgUGhpbGlwcGUgd3JvdGU6
DQo+IEhpIExpc3QsDQo+IA0KPiBJIHJhbiBhIHN0dXBpZCB0ZXN0ICh1c2luZyB0aGUga2VybmVs
J3Mga25mc2QpIDogSSBmaWxsZWQgdXAgY29tcGxldGVseSANCj4gYSBmaWxlc3lzdGVtIHdpdGgg
YSBmZXcgYmlnIGZpbGUuIFdoZW4gaXQgd2FzIDEwMCUgZnVsbCAobm8gZnJlZSBibG9jayANCj4g
YXQgYWxsKSwgSSByYW4gYSBkZCBvbiBpdC4NCj4gVGhlIGRkIHNhaWQgaXQgY291bGQgd3JpdGUg
NzkzIGJsb2NrcyBvZiBzaXplIDFtYiAgYW5kIGZhaWxlZCBvbiBJTyANCj4gZXJyb3IuIEF0IHRo
ZSBlbmQsIEkgY291bGQgc2VlIGFuIGVtcHR5IGZpbGUgaW4gdGhlIE5GUyBleHBvcnRlZCB0cmVl
Lg0KPiBRdWVzdGlvbiBpcyA6DQo+ICAgICAtIHdoeSBkaWQgSSBnZXQgRUlPIGFuZCBub3QgRU5P
U1BDID8NCg0KRGlkIHRoZSBzZXJ2ZXIgYWN0dWFsbHkgcmV0dXJuIE5GUzNFUlJfTk9TUEMsIG9y
IGRpZCBpdCByZXR1cm4gc29tZXRoaW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FpbmVyDQoNCk5ldEFwcA0KVHJvbmQuTXlrbGVidXN0QG5ldGFwcC5j
b20NCnd3dy5uZXRhcHAuY29tDQoNCg==

2012-03-05 21:42:47

by Malahal Naineni

[permalink] [raw]
Subject: Re: How does the client manage NFS3ERR_NOSPC ?

Myklebust, Trond [[email protected]] wrote:
> On Mon, 2012-03-05 at 18:16 +0100, DENIEL Philippe wrote:
> > Hi List,
> >
> > I ran a stupid test (using the kernel's knfsd) : I filled up completely
> > a filesystem with a few big file. When it was 100% full (no free block
> > at all), I ran a dd on it.
> > The dd said it could write 793 blocks of size 1mb and failed on IO
> > error. At the end, I could see an empty file in the NFS exported tree.
> > Question is :
> > - why did I get EIO and not ENOSPC ?
>
> Did the server actually return NFS3ERR_NOSPC, or did it return something
> else? If the server returns NFS3ERR_NOSPC, then I'd expect the client to
> translate that as ENOSPC.

AFAIR, the server returns ENOSPC but the Linux client has a bug under
certain cases that returns it as EIO. Filed a bug and Neil sent a patch
but I have not tested it yet.

I tried with various versions and they gave some differing results. I
think in one case fsync() got ENOSPC but close() got EIO (or the other
way around?)

Regards, Malahal.
PS: Easy way to reproduce the problem, just run the following:
dd if=/dev/zero of=./testfile conv=fdatasync