diff options
Diffstat (limited to 'fs/btrfs/disk-io.c')
| -rw-r--r-- | fs/btrfs/disk-io.c | 8 | 
1 files changed, 8 insertions, 0 deletions
| diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index 514ead6e93b6..b3f2e2232326 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c @@ -1732,6 +1732,14 @@ again:  	}  	return root;  fail: +	/* +	 * If our caller provided us an anonymous device, then it's his +	 * responsability to free it in case we fail. So we have to set our +	 * root's anon_dev to 0 to avoid a double free, once by btrfs_put_root() +	 * and once again by our caller. +	 */ +	if (anon_dev) +		root->anon_dev = 0;  	btrfs_put_root(root);  	return ERR_PTR(ret);  } |