dcache.c (1ffe46d11cc88479797b262f60d92e5fb461b411) | dcache.c (5542aa2fa7f6cddb03c4ac3135e390adffda98ca) |
---|---|
1/* 2 * fs/dcache.c 3 * 4 * Complete reimplementation 5 * (C) 1997 Thomas Schoebel-Theuer, 6 * with heavy changes by Linus Torvalds 7 */ 8 --- 1332 unchanged lines hidden (view full) --- 1341 if (!data->mountpoint && !data->select.found) 1342 __d_drop(data->select.start); 1343} 1344 1345/** 1346 * d_invalidate - detach submounts, prune dcache, and drop 1347 * @dentry: dentry to invalidate (aka detach, prune and drop) 1348 * | 1/* 2 * fs/dcache.c 3 * 4 * Complete reimplementation 5 * (C) 1997 Thomas Schoebel-Theuer, 6 * with heavy changes by Linus Torvalds 7 */ 8 --- 1332 unchanged lines hidden (view full) --- 1341 if (!data->mountpoint && !data->select.found) 1342 __d_drop(data->select.start); 1343} 1344 1345/** 1346 * d_invalidate - detach submounts, prune dcache, and drop 1347 * @dentry: dentry to invalidate (aka detach, prune and drop) 1348 * |
1349 * Try to invalidate the dentry if it turns out to be 1350 * possible. If there are reasons not to delete it 1351 * return -EBUSY. On success return 0. 1352 * | |
1353 * no dcache lock. 1354 * 1355 * The final d_drop is done as an atomic operation relative to 1356 * rename_lock ensuring there are no races with d_set_mounted. This 1357 * ensures there are no unhashed dentries on the path to a mountpoint. 1358 */ | 1349 * no dcache lock. 1350 * 1351 * The final d_drop is done as an atomic operation relative to 1352 * rename_lock ensuring there are no races with d_set_mounted. This 1353 * ensures there are no unhashed dentries on the path to a mountpoint. 1354 */ |
1359int d_invalidate(struct dentry *dentry) | 1355void d_invalidate(struct dentry *dentry) |
1360{ | 1356{ |
1361 int ret = 0; 1362 | |
1363 /* 1364 * If it's already been dropped, return OK. 1365 */ 1366 spin_lock(&dentry->d_lock); 1367 if (d_unhashed(dentry)) { 1368 spin_unlock(&dentry->d_lock); | 1357 /* 1358 * If it's already been dropped, return OK. 1359 */ 1360 spin_lock(&dentry->d_lock); 1361 if (d_unhashed(dentry)) { 1362 spin_unlock(&dentry->d_lock); |
1369 return 0; | 1363 return; |
1370 } 1371 spin_unlock(&dentry->d_lock); 1372 1373 /* Negative dentries can be dropped without further checks */ 1374 if (!dentry->d_inode) { 1375 d_drop(dentry); | 1364 } 1365 spin_unlock(&dentry->d_lock); 1366 1367 /* Negative dentries can be dropped without further checks */ 1368 if (!dentry->d_inode) { 1369 d_drop(dentry); |
1376 goto out; | 1370 return; |
1377 } 1378 1379 for (;;) { 1380 struct detach_data data; 1381 1382 data.mountpoint = NULL; 1383 INIT_LIST_HEAD(&data.select.dispose); 1384 data.select.start = dentry; --- 9 unchanged lines hidden (view full) --- 1394 dput(data.mountpoint); 1395 } 1396 1397 if (!data.mountpoint && !data.select.found) 1398 break; 1399 1400 cond_resched(); 1401 } | 1371 } 1372 1373 for (;;) { 1374 struct detach_data data; 1375 1376 data.mountpoint = NULL; 1377 INIT_LIST_HEAD(&data.select.dispose); 1378 data.select.start = dentry; --- 9 unchanged lines hidden (view full) --- 1388 dput(data.mountpoint); 1389 } 1390 1391 if (!data.mountpoint && !data.select.found) 1392 break; 1393 1394 cond_resched(); 1395 } |
1402 1403out: 1404 return ret; | |
1405} 1406EXPORT_SYMBOL(d_invalidate); 1407 1408/** 1409 * __d_alloc - allocate a dcache entry 1410 * @sb: filesystem it will belong to 1411 * @name: qstr of the name 1412 * --- 2029 unchanged lines hidden --- | 1396} 1397EXPORT_SYMBOL(d_invalidate); 1398 1399/** 1400 * __d_alloc - allocate a dcache entry 1401 * @sb: filesystem it will belong to 1402 * @name: qstr of the name 1403 * --- 2029 unchanged lines hidden --- |