aboutsummaryrefslogtreecommitdiffstats
path: root/fs/devfs/base.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/devfs/base.c')
-rw-r--r--fs/devfs/base.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/fs/devfs/base.c b/fs/devfs/base.c
index 1274422a5384..b621521e09d4 100644
--- a/fs/devfs/base.c
+++ b/fs/devfs/base.c
@@ -2162,27 +2162,27 @@ static int devfs_d_revalidate_wait(struct dentry *dentry, struct nameidata *nd)
2162 * 2162 *
2163 * make sure that 2163 * make sure that
2164 * d_instantiate always runs under lock 2164 * d_instantiate always runs under lock
2165 * we release i_sem lock before going to sleep 2165 * we release i_mutex lock before going to sleep
2166 * 2166 *
2167 * unfortunately sometimes d_revalidate is called with 2167 * unfortunately sometimes d_revalidate is called with
2168 * and sometimes without i_sem lock held. The following checks 2168 * and sometimes without i_mutex lock held. The following checks
2169 * attempt to deduce when we need to add (and drop resp.) lock 2169 * attempt to deduce when we need to add (and drop resp.) lock
2170 * here. This relies on current (2.6.2) calling coventions: 2170 * here. This relies on current (2.6.2) calling coventions:
2171 * 2171 *
2172 * lookup_hash is always run under i_sem and is passing NULL 2172 * lookup_hash is always run under i_mutex and is passing NULL
2173 * as nd 2173 * as nd
2174 * 2174 *
2175 * open(...,O_CREATE,...) calls _lookup_hash under i_sem 2175 * open(...,O_CREATE,...) calls _lookup_hash under i_mutex
2176 * and sets flags to LOOKUP_OPEN|LOOKUP_CREATE 2176 * and sets flags to LOOKUP_OPEN|LOOKUP_CREATE
2177 * 2177 *
2178 * all other invocations of ->d_revalidate seem to happen 2178 * all other invocations of ->d_revalidate seem to happen
2179 * outside of i_sem 2179 * outside of i_mutex
2180 */ 2180 */
2181 need_lock = nd && 2181 need_lock = nd &&
2182 (!(nd->flags & LOOKUP_CREATE) || (nd->flags & LOOKUP_PARENT)); 2182 (!(nd->flags & LOOKUP_CREATE) || (nd->flags & LOOKUP_PARENT));
2183 2183
2184 if (need_lock) 2184 if (need_lock)
2185 down(&dir->i_sem); 2185 mutex_lock(&dir->i_mutex);
2186 2186
2187 if (is_devfsd_or_child(fs_info)) { 2187 if (is_devfsd_or_child(fs_info)) {
2188 devfs_handle_t de = lookup_info->de; 2188 devfs_handle_t de = lookup_info->de;
@@ -2221,9 +2221,9 @@ static int devfs_d_revalidate_wait(struct dentry *dentry, struct nameidata *nd)
2221 add_wait_queue(&lookup_info->wait_queue, &wait); 2221 add_wait_queue(&lookup_info->wait_queue, &wait);
2222 read_unlock(&parent->u.dir.lock); 2222 read_unlock(&parent->u.dir.lock);
2223 /* at this point it is always (hopefully) locked */ 2223 /* at this point it is always (hopefully) locked */
2224 up(&dir->i_sem); 2224 mutex_unlock(&dir->i_mutex);
2225 schedule(); 2225 schedule();
2226 down(&dir->i_sem); 2226 mutex_lock(&dir->i_mutex);
2227 /* 2227 /*
2228 * This does not need nor should remove wait from wait_queue. 2228 * This does not need nor should remove wait from wait_queue.
2229 * Wait queue head is never reused - nothing is ever added to it 2229 * Wait queue head is never reused - nothing is ever added to it
@@ -2238,7 +2238,7 @@ static int devfs_d_revalidate_wait(struct dentry *dentry, struct nameidata *nd)
2238 2238
2239 out: 2239 out:
2240 if (need_lock) 2240 if (need_lock)
2241 up(&dir->i_sem); 2241 mutex_unlock(&dir->i_mutex);
2242 return 1; 2242 return 1;
2243} /* End Function devfs_d_revalidate_wait */ 2243} /* End Function devfs_d_revalidate_wait */
2244 2244
@@ -2284,9 +2284,9 @@ static struct dentry *devfs_lookup(struct inode *dir, struct dentry *dentry,
2284 /* Unlock directory semaphore, which will release any waiters. They 2284 /* Unlock directory semaphore, which will release any waiters. They
2285 will get the hashed dentry, and may be forced to wait for 2285 will get the hashed dentry, and may be forced to wait for
2286 revalidation */ 2286 revalidation */
2287 up(&dir->i_sem); 2287 mutex_unlock(&dir->i_mutex);
2288 wait_for_devfsd_finished(fs_info); /* If I'm not devfsd, must wait */ 2288 wait_for_devfsd_finished(fs_info); /* If I'm not devfsd, must wait */
2289 down(&dir->i_sem); /* Grab it again because them's the rules */ 2289 mutex_lock(&dir->i_mutex); /* Grab it again because them's the rules */
2290 de = lookup_info.de; 2290 de = lookup_info.de;
2291 /* If someone else has been so kind as to make the inode, we go home 2291 /* If someone else has been so kind as to make the inode, we go home
2292 early */ 2292 early */