[2228] in SIPB-AFS-requests
Volumes can be created in unmounted directories
daemon@ATHENA.MIT.EDU (Greg Hudson)
Mon Jan 8 07:42:21 1996
Date: Mon, 8 Jan 1996 07:42:08 -0500
From: Greg Hudson <ghudson@MIT.EDU>
To: bug-afs@MIT.EDU
Cc: sipb-afsreq@MIT.EDU
If you have a directory /vicepX on the filesystem of an AFS server,
with nothing mounted there, operations like "vos listvol servername
X", "vos create servername X foo.bar", etc. will fail with "vos :
partition X does not exist on the server". However, this check is
only performed on the client side, and is sometimes not performed. In
particular, "vos release" does not perform this check on the
replication sites of a volume, so you can "vos release" onto the root
partition of an AFS server. (Actually, it doesn't work very well; for
reasons I can't discern, the server fails to subsequently attach the
volume, claiming that it can't read the volume header. Nevertheless,
the volume header is created along with some unlinked inodes.)
I do not currently have a good build setup for AFS servers, so I'm not
easily able to test a fix right now. Here is a sample, untested fix
to the volume server code to make the server verify the partition at
volume creation time:
*** volprocs.c.orig Mon Jan 8 07:34:39 1996
--- volprocs.c Mon Jan 8 07:39:38 1996
***************
*** 347,357 ****
--- 347,363 ----
register struct volser_trans *tt;
char ppath[30];
char caller[MAXKTCNAMELEN];
+ struct stat rbuf, pbuf;
if (strlen(aname) > 31) return VOLSERBADNAME;
if (!afsconf_SuperUser(tdir, acid, caller)) return VOLSERBAD_ACCESS;
if (DoLogging) Log("%s is executing CreateVolume '%s'\n", caller, aname);
if (error = ConvertPartition(apart, ppath, sizeof(ppath))) return error;/*a standard unix error*/
+ stat("/", &rbuf);
+ if (stat(ppath, &pbuf) < 0 || rbuf.st_dev == pbuf.st_dev) {
+ Log("1 Volser: CreateVolume: %s not mounted; %s volume not created\n",ppath,aname);
+ return VOLSERILLEGAL_PARTITION;
+ }
if (atype != readwriteVolume && atype != readonlyVolume && atype != backupVolume)
return EINVAL;
if ((volumeID = *avolid) == 0) {