Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F167019858
D37896.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D37896.diff
View Options
diff --git a/sys/kern/kern_descrip.c b/sys/kern/kern_descrip.c
--- a/sys/kern/kern_descrip.c
+++ b/sys/kern/kern_descrip.c
@@ -4172,6 +4172,29 @@
vrele(olddp);
}
+int
+descrip_check_write_mp(struct filedesc *fdp, struct mount *mp)
+{
+ struct file *fp;
+ struct vnode *vp;
+ int error, i;
+
+ error = 0;
+ FILEDESC_SLOCK(fdp);
+ FILEDESC_FOREACH_FP(fdp, i, fp) {
+ if (fp->f_type != DTYPE_VNODE ||
+ (atomic_load_int(&fp->f_flag) & FWRITE) == 0)
+ continue;
+ vp = fp->f_vnode;
+ if (vp->v_mount == mp) {
+ error = EDEADLK;
+ break;
+ }
+ }
+ FILEDESC_SUNLOCK(fdp);
+ return (error);
+}
+
struct filedesc_to_leader *
filedesc_to_leader_alloc(struct filedesc_to_leader *old, struct filedesc *fdp,
struct proc *leader)
diff --git a/sys/sys/filedesc.h b/sys/sys/filedesc.h
--- a/sys/sys/filedesc.h
+++ b/sys/sys/filedesc.h
@@ -225,6 +225,7 @@
#define falloc(td, resultfp, resultfd, flags) \
falloc_caps(td, resultfp, resultfd, flags, NULL)
+struct mount;
struct thread;
static __inline void
@@ -241,6 +242,7 @@
int closef(struct file *fp, struct thread *td);
void closef_nothread(struct file *fp);
+int descrip_check_write_mp(struct filedesc *fdp, struct mount *mp);
int dupfdopen(struct thread *td, struct filedesc *fdp, int dfd, int mode,
int openerror, int *indxp);
int falloc_caps(struct thread *td, struct file **resultfp, int *resultfd,
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Aug 19, 3:17 PM (2 h, 22 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
36941558
Default Alt Text
D37896.diff (1 KB)
Attached To
Mode
D37896: ufs/suspend: deny suspension if calliing process has file from mp opened for write
Attached
Detach File
Event Timeline
Log In to Comment