diff options
author | Thomas Bushnell <thomas@gnu.org> | 1996-08-13 20:09:00 +0000 |
---|---|---|
committer | Thomas Bushnell <thomas@gnu.org> | 1996-08-13 20:09:00 +0000 |
commit | 7f95a8a4c1a999bee77a323489341505abe2d3db (patch) | |
tree | b75b85bc8d298d7b0b015d2a9b7400310515f793 /nfs | |
parent | b615272fa6dc79bd23eba5fe889733773076779d (diff) |
*** empty log message ***
Diffstat (limited to 'nfs')
-rw-r--r-- | nfs/ChangeLog | 11 | ||||
-rw-r--r-- | nfs/ops.c | 33 |
2 files changed, 44 insertions, 0 deletions
diff --git a/nfs/ChangeLog b/nfs/ChangeLog index 23d5ba38..ee69f4ef 100644 --- a/nfs/ChangeLog +++ b/nfs/ChangeLog @@ -1,3 +1,14 @@ +Tue Aug 13 14:57:03 1996 Thomas Bushnell, n/BSG <thomas@gnu.ai.mit.edu> + + * ops.c (netfs_attempt_create_file): Sun's NFS client does not + expect NFSPROC_CREATE to be exclusive. Accordingly, on most + servers (including ours) it isn't exclusive. (Which, of course, + contradicts Sun's own RGC 1094, section 2.2.10.) Which means we + have to insert our own test here to make sure the file doesn't + exist before attempting NFSPROC_CREATE. + (netfs_attempt_link): Likewise. + (verify_nonexistent): New function. + Mon Aug 12 11:13:58 1996 Thomas Bushnell, n/BSG <thomas@gnu.ai.mit.edu> * nfs.c (nfs_error_trans): Repair syntax. @@ -409,6 +409,30 @@ netfs_attempt_write (struct netcred *cred, struct node *np, return 0; } +/* See if NAME exists in DIR for CRED. If so, return EEXIST. */ +error_t +verify_nonexistent (struct netcred *cred, struct node *dir, + char *name) +{ + int *p; + void *rpcbuf; + error_t err; + + p = nfs_initialize_rpc (NFSPROC_LOOKUP, cred, 0, &rpcbuf, dir, -1); + p = xdr_encode_fhandle (p, &dir->nn->handle); + p = xdr_encode_string (p, name); + + mutex_lock (&dir->lock); + err = conduct_rpc (&rpcbuf, &p); + if (!err) + err = nfs_error_trans (ntohl (*p++)); + + if (!err) + return EEXIST; + else + return 0; +} + /* Implement the netfs_attempt_lookup callback as described in <hurd/netfs.h>. */ error_t @@ -594,6 +618,11 @@ netfs_attempt_link (struct netcred *cred, struct node *dir, case BLKDEV: case FIFO: case SOCK: + + err = verify_nonexistent (cred, dir, name); + if (err) + return err; + mutex_lock (&dir->lock); p = nfs_initialize_rpc (NFSPROC_CREATE, cred, 0, &rpcbuf, dir, -1); p = xdr_encode_fhandle (p, &dir->nn->handle); @@ -704,6 +733,10 @@ netfs_attempt_create_file (struct netcred *cred, struct node *np, void *rpcbuf; error_t err; + err = verify_nonexistent (cred, np, name); + if (err) + return err; + p = nfs_initialize_rpc (NFSPROC_CREATE, cred, 0, &rpcbuf, np, -1); p = xdr_encode_fhandle (p, &np->nn->handle); p = xdr_encode_string (p, name); |