From: Al Viro <viro@zeniv.linux.org.uk>
Date: Tue, 23 Jun 2015 22:01:30 +0000 (-0400)
Subject: Merge branch 'fscache-fixes' into for-next
X-Git-Tag: firefly_0821_release~176^2~1459^2~17
X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=8ea3a7c0df05b2cb33e2d63aa1c964308724b1c4;p=firefly-linux-kernel-4.4.55.git

Merge branch 'fscache-fixes' into for-next
---

8ea3a7c0df05b2cb33e2d63aa1c964308724b1c4
diff --cc fs/cachefiles/namei.c
index ab857ab9f40d,1d60195fc518..fc1056f5c96a
--- a/fs/cachefiles/namei.c
+++ b/fs/cachefiles/namei.c
@@@ -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);
@@@ -548,10 -552,10 +552,10 @@@
  
  	} 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);
@@@ -659,9 -665,11 +665,11 @@@
  	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)