Merge branch 'fscache-fixes' into for-next
authorAl Viro <viro@zeniv.linux.org.uk>
Tue, 23 Jun 2015 22:01:30 +0000 (18:01 -0400)
committerAl Viro <viro@zeniv.linux.org.uk>
Tue, 23 Jun 2015 22:01:30 +0000 (18:01 -0400)
1  2 
fs/cachefiles/namei.c

index ab857ab9f40d91a375a31030e1872f9ebd704837,1d60195fc5187f8b95191e89d3f400d8d9b9ee3a..fc1056f5c96a3c750c3c5c9009048b234a7fd745
@@@ -286,13 -289,13 +289,13 @@@ static int cachefiles_bury_object(struc
                if (ret < 0) {
                        cachefiles_io_error(cache, "Unlink security error");
                } else {
 -                      ret = vfs_unlink(dir->d_inode, rep, NULL);
 +                      ret = vfs_unlink(d_inode(dir), rep, NULL);
  
                        if (preemptive)
-                               cachefiles_mark_object_buried(cache, rep);
+                               cachefiles_mark_object_buried(cache, rep, why);
                }
  
 -              mutex_unlock(&dir->d_inode->i_mutex);
 +              mutex_unlock(&d_inode(dir)->i_mutex);
  
                if (ret == -EIO)
                        cachefiles_io_error(cache, "Unlink failed");
@@@ -420,9 -423,9 +423,9 @@@ int cachefiles_delete_object(struct cac
  
        dir = dget_parent(object->dentry);
  
 -      mutex_lock_nested(&dir->d_inode->i_mutex, I_MUTEX_PARENT);
 +      mutex_lock_nested(&d_inode(dir)->i_mutex, I_MUTEX_PARENT);
  
-       if (test_bit(CACHEFILES_OBJECT_BURIED, &object->flags)) {
+       if (test_bit(FSCACHE_OBJECT_KILLED_BY_CACHE, &object->fscache.flags)) {
                /* object allocation for the same key preemptively deleted this
                 * object's file so that it could create its own file */
                _debug("object preemptively buried");
@@@ -519,10 -523,10 +523,10 @@@ lookup_again
        /* we need to create the object if it's negative */
        if (key || object->type == FSCACHE_COOKIE_TYPE_INDEX) {
                /* index objects and intervening tree levels must be subdirs */
 -              if (!next->d_inode) {
 +              if (d_is_negative(next)) {
                        ret = cachefiles_has_space(cache, 1, 0);
                        if (ret < 0)
-                               goto create_error;
+                               goto no_space_error;
  
                        path.dentry = dir;
                        ret = security_path_mkdir(&path, next, 0);
  
        } else {
                /* non-index objects start out life as files */
 -              if (!next->d_inode) {
 +              if (d_is_negative(next)) {
                        ret = cachefiles_has_space(cache, 1, 0);
                        if (ret < 0)
-                               goto create_error;
+                               goto no_space_error;
  
                        path.dentry = dir;
                        ret = security_path_mknod(&path, next, S_IFREG, 0);
        object->new = 0;
        fscache_obtained_object(&object->fscache);
  
 -      _leave(" = 0 [%lu]", object->dentry->d_inode->i_ino);
 +      _leave(" = 0 [%lu]", d_backing_inode(object->dentry)->i_ino);
        return 0;
  
+ no_space_error:
+       fscache_object_mark_killed(&object->fscache, FSCACHE_OBJECT_NO_SPACE);
  create_error:
        _debug("create error %d", ret);
        if (ret == -EIO)