File tree Expand file tree Collapse file tree 1 file changed +10
-0
lines changed
Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -41,6 +41,7 @@ struct cdev mu2e_cdev;
4141
4242static int mu2e_dtc_count [MU2E_MAX_NUM_DTCS ] = {0 };
4343static kuid_t mu2e_dtc_owner [MU2E_MAX_NUM_DTCS ] = {{0 }};
44+ static kuid_t root_uid = {{0 }};
4445static DEFINE_SPINLOCK (mu2e_fs_spinlock );
4546
4647int mu2e_fs_up ()
@@ -98,7 +99,11 @@ int mu2e_open(struct inode *inode, struct file *filp)
9899 }
99100
100101 if (mu2e_dtc_count [dtc ] == 0 )
102+ {
101103 mu2e_dtc_owner [dtc ] = current_uid (); /* grab it */
104+ inode -> i_uid = current_uid ();
105+ mark_inode_dirty (inode );
106+ }
102107
103108 mu2e_dtc_count [dtc ]++ ;
104109 spin_unlock (& mu2e_fs_spinlock );
@@ -111,6 +116,11 @@ int mu2e_release(struct inode *inode, struct file *filp)
111116 int dtc = iminor (inode );
112117 spin_lock (& mu2e_fs_spinlock );
113118 mu2e_dtc_count [dtc ]-- ;
119+ if (mu2e_dtc_count [dtc ] == 0 )
120+ {
121+ inode -> i_uid = root_uid ;
122+ mark_inode_dirty (inode );
123+ }
114124 spin_unlock (& mu2e_fs_spinlock );
115125 return 0 ;
116126}
You can’t perform that action at this time.
0 commit comments