[OpenAFS] On the wording "No space left on device"

Andrew Deason zeroguy@verizon.net
Wed, 30 Jan 2008 18:03:56 -0600


This is a multi-part message in MIME format.

--Multipart=_Wed__30_Jan_2008_18_03_56_-0600_AkAGzjxnzO1bY4nv
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit

Hm, should this move to openafs-devel?

On Wed, 30 Jan 2008 09:27:23 -0500
"Derrick Brashear" <shadow@gmail.com> wrote:

> Look at afs_CheckCode in src/afs/afs_analyze.c and tell me what you
> think.
> 
> Code looks right to me (though, obviously something's wrong)

You mean src/afs/afs_error.c ? That doesn't appear to be causing the
error, as it's receiving ENOSPC as acode and returning it as-is, as the
following DTrace script shows:

# cat checkcode.d
fbt:afs:afs_CheckCode:entry {
   self->spec = speculation();
   speculate(self->spec);
   printf("afs_CheckCode acode = %d", arg0);
}
fbt:afs:afs_CheckCode:return /self->spec && arg1 == 28/ {
   speculate(self->spec);
   printf("afs_CheckCode returned %d", arg1);
   commit(self->spec);
   self->spec = 0;
}
fbt:afs:afs_CheckCode:return /self->spec/ {
   discard(self->spec);
   self->spec = 0;
}

# ( sleep 4 ; echo foo > fullvolume/bar ) & dtrace -s checkcode.d 
[1] 4183
dtrace: script 'checkcode.d' matched 3 probes
/usr/local/bin/bash: line 104: fullvolume/bar: No space left on device
CPU     ID                    FUNCTION:NAME
1     7652              afs_CheckCode:entry afs_CheckCode acode = 28
1     7653             afs_CheckCode:return afs_CheckCode returned 28
^C

So the question is, what's giving it ENOSPC?

# cat enospc.d
fbt:afs::return /arg1 == 28/ {
   printf("Returned ENOSPC");
}
# ( sleep 4 ; echo foo > fullvolume/bar ) & dtrace -s enospc.d
[1] 4249
dtrace: script 'enospc.d' matched 1066 probes
/usr/local/bin/bash: line 110: fullvolume/bar: No space left on device
CPU     ID                    FUNCTION:NAME
0     7103          ntoh_syserr_conv:return Returned ENOSPC
0     7657                rx_EndCall:return Returned ENOSPC
0     6683          RXAFS_CreateFile:return Returned ENOSPC
0     7653             afs_CheckCode:return Returned ENOSPC
0     6955                afs_create:return Returned ENOSPC
0     6975               gafs_create:return Returned ENOSPC
^C

So, looks like the culript is ntoh_syserr_conv in src/rx/rx_misc.c,
which explicitly returns ENOSPC instead of EDQUOT when Solaris is
detected. I've attached a patch (untested) to just return EDQUOT when
it's defined, and ENOSPC otherwise. There's a lot of other code in
there, though, that assumes EDQUOT doesn't exist on Solaris at all.
There's plenty of other functions that appear to have the same issue as
this that I didn't touch at all.

It seems like a lot of conditionals could be changed from
defined(AFS_SUN5_ENV) to defined(AFS_SUN5_ENV) &&
!defined(AFS_SUN58_ENV) or something, but I thought checking on
EDQUOT's presence would be more robust.

-- 
Andrew Deason
zeroguy@verizon.net

--Multipart=_Wed__30_Jan_2008_18_03_56_-0600_AkAGzjxnzO1bY4nv
Content-Type: text/x-diff;
 name="openafs-solaris-edquot.patch"
Content-Disposition: attachment;
 filename="openafs-solaris-edquot.patch"
Content-Transfer-Encoding: 7bit

Index: rx_misc.c
===================================================================
RCS file: /cvs/openafs/src/rx/rx_misc.c,v
retrieving revision 1.15
diff -u -r1.15 rx_misc.c
--- rx_misc.c	30 Oct 2007 15:10:48 -0000	1.15
+++ rx_misc.c	30 Jan 2008 23:18:58 -0000
@@ -76,7 +76,7 @@
     if (code == VDISKFULL)
 	err = ENOSPC;
     else if (code == VOVERQUOTA)
-#if defined(AFS_SUN5_ENV) || defined(AFS_NT40_ENV) 
+#ifndef EDQUOT
 	err = ENOSPC;
 #else
 	err = EDQUOT;

--Multipart=_Wed__30_Jan_2008_18_03_56_-0600_AkAGzjxnzO1bY4nv--