getdirentries: return ENOENT for unlinked but still open directory.
To be more compatible to IEEE Std 1003.1-2008 (“POSIX.1”). Reviewed by: mjg, Pau Amma (doc) Differential revision: https://reviews.freebsd.org/D34680 MFC after: 2 weeks
This commit is contained in:
parent
bb46e9b510
commit
c6487446d7
@ -193,6 +193,8 @@ An
|
|||||||
error occurred while reading from or writing to the file system.
|
error occurred while reading from or writing to the file system.
|
||||||
.It Bq Er EINTEGRITY
|
.It Bq Er EINTEGRITY
|
||||||
Corrupted data was detected while reading from the file system.
|
Corrupted data was detected while reading from the file system.
|
||||||
|
.It Bq Er ENOENT
|
||||||
|
Directory unlinked but still open.
|
||||||
.El
|
.El
|
||||||
.Sh SEE ALSO
|
.Sh SEE ALSO
|
||||||
.Xr lseek 2 ,
|
.Xr lseek 2 ,
|
||||||
|
@ -5980,6 +5980,7 @@ vop_rmdir_post(void *ap, int rc)
|
|||||||
vn_seqc_write_end(dvp);
|
vn_seqc_write_end(dvp);
|
||||||
vn_seqc_write_end(vp);
|
vn_seqc_write_end(vp);
|
||||||
if (!rc) {
|
if (!rc) {
|
||||||
|
vp->v_vflag |= VV_UNLINKED;
|
||||||
VFS_KNOTE_LOCKED(dvp, NOTE_WRITE | NOTE_LINK);
|
VFS_KNOTE_LOCKED(dvp, NOTE_WRITE | NOTE_LINK);
|
||||||
VFS_KNOTE_LOCKED(vp, NOTE_DELETE);
|
VFS_KNOTE_LOCKED(vp, NOTE_DELETE);
|
||||||
}
|
}
|
||||||
|
@ -4195,6 +4195,10 @@ kern_getdirentries(struct thread *td, int fd, char *buf, size_t count,
|
|||||||
error = EINVAL;
|
error = EINVAL;
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
if (__predict_false((vp->v_vflag & VV_UNLINKED) != 0)) {
|
||||||
|
error = ENOENT;
|
||||||
|
goto fail;
|
||||||
|
}
|
||||||
aiov.iov_base = buf;
|
aiov.iov_base = buf;
|
||||||
aiov.iov_len = count;
|
aiov.iov_len = count;
|
||||||
auio.uio_iov = &aiov;
|
auio.uio_iov = &aiov;
|
||||||
|
@ -270,7 +270,7 @@ struct xvnode {
|
|||||||
#define VV_COPYONWRITE 0x0040 /* vnode is doing copy-on-write */
|
#define VV_COPYONWRITE 0x0040 /* vnode is doing copy-on-write */
|
||||||
#define VV_SYSTEM 0x0080 /* vnode being used by kernel */
|
#define VV_SYSTEM 0x0080 /* vnode being used by kernel */
|
||||||
#define VV_PROCDEP 0x0100 /* vnode is process dependent */
|
#define VV_PROCDEP 0x0100 /* vnode is process dependent */
|
||||||
/* UNUSED 0x0200 */
|
#define VV_UNLINKED 0x0200 /* unlinked but stil open directory */
|
||||||
#define VV_DELETED 0x0400 /* should be removed */
|
#define VV_DELETED 0x0400 /* should be removed */
|
||||||
#define VV_MD 0x0800 /* vnode backs the md device */
|
#define VV_MD 0x0800 /* vnode backs the md device */
|
||||||
#define VV_FORCEINSMQ 0x1000 /* force the insmntque to succeed */
|
#define VV_FORCEINSMQ 0x1000 /* force the insmntque to succeed */
|
||||||
|
Loading…
Reference in New Issue
Block a user