diff options
Diffstat (limited to 'fs')
-rw-r--r-- | fs/cachefiles/namei.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/fs/cachefiles/namei.c b/fs/cachefiles/namei.c index 14ac4806e291..eeb4986ea7db 100644 --- a/fs/cachefiles/namei.c +++ b/fs/cachefiles/namei.c | |||
@@ -348,7 +348,17 @@ int cachefiles_delete_object(struct cachefiles_cache *cache, | |||
348 | dir = dget_parent(object->dentry); | 348 | dir = dget_parent(object->dentry); |
349 | 349 | ||
350 | mutex_lock_nested(&dir->d_inode->i_mutex, I_MUTEX_PARENT); | 350 | mutex_lock_nested(&dir->d_inode->i_mutex, I_MUTEX_PARENT); |
351 | ret = cachefiles_bury_object(cache, dir, object->dentry); | 351 | |
352 | /* we need to check that our parent is _still_ our parent - it may have | ||
353 | * been renamed */ | ||
354 | if (dir == object->dentry->d_parent) { | ||
355 | ret = cachefiles_bury_object(cache, dir, object->dentry); | ||
356 | } else { | ||
357 | /* it got moved, presumably by cachefilesd culling it, so it's | ||
358 | * no longer in the key path and we can ignore it */ | ||
359 | mutex_unlock(&dir->d_inode->i_mutex); | ||
360 | ret = 0; | ||
361 | } | ||
352 | 362 | ||
353 | dput(dir); | 363 | dput(dir); |
354 | _leave(" = %d", ret); | 364 | _leave(" = %d", ret); |