diff options
author | mckusick <mckusick@FreeBSD.org> | 2000-07-04 03:34:11 +0000 |
---|---|---|
committer | mckusick <mckusick@FreeBSD.org> | 2000-07-04 03:34:11 +0000 |
commit | 040e64cd9770955113ddffda73fff7b62dd5959b (patch) | |
tree | 4d2f06b02c643384c981cf2399da8d136ee8a568 /sys/geom | |
parent | 806786489f486969418422381048f277d86e0a20 (diff) | |
download | FreeBSD-src-040e64cd9770955113ddffda73fff7b62dd5959b.zip FreeBSD-src-040e64cd9770955113ddffda73fff7b62dd5959b.tar.gz |
Move the truncation code out of vn_open and into the open system call
after the acquisition of any advisory locks. This fix corrects a case
in which a process tries to open a file with a non-blocking exclusive
lock. Even if it fails to get the lock it would still truncate the
file even though its open failed. With this change, the truncation
is done only after the lock is successfully acquired.
Obtained from: BSD/OS
Diffstat (limited to 'sys/geom')
-rw-r--r-- | sys/geom/geom_ccd.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/sys/geom/geom_ccd.c b/sys/geom/geom_ccd.c index 3f62c1a..5a478f7 100644 --- a/sys/geom/geom_ccd.c +++ b/sys/geom/geom_ccd.c @@ -1538,10 +1538,11 @@ ccdlookup(path, p, vpp) { struct nameidata nd; struct vnode *vp; - int error; + int error, flags; NDINIT(&nd, LOOKUP, FOLLOW, UIO_USERSPACE, path, p); - if ((error = vn_open(&nd, FREAD|FWRITE, 0)) != 0) { + flags = FREAD | FWRITE; + if ((error = vn_open(&nd, &flags, 0)) != 0) { #ifdef DEBUG if (ccddebug & CCDB_FOLLOW|CCDB_INIT) printf("ccdlookup: vn_open error = %d\n", error); |