[PATCH 1/2] loop: use filp_close() rather than fput()
Date: Fri Jun 16 2017 - 01:04:37 EST
When a loop device is being shutdown the backing file is
closed with fput(). This is different from how close(2)
closes files - it uses filp_close().
The difference is important for filesystems which provide a ->flush
file operation such as NFS. NFS assumes a flush will always
be called on last close, and gets confused otherwise.
Signed-off-by: NeilBrown <neilb@xxxxxxxx>
drivers/block/loop.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/block/loop.c b/drivers/block/loop.c
index ebbd0c3fe0ed..9c457ca6c55e 100644
@@ -682,7 +682,7 @@ static int loop_change_fd(struct loop_device *lo, struct block_device *bdev,
+ filp_close(old_file, NULL);
if (lo->lo_flags & LO_FLAGS_PARTSCAN)
@@ -1071,12 +1071,12 @@ static int loop_clr_fd(struct loop_device *lo)
- * Need not hold lo_ctl_mutex to fput backing file.
+ * Need not hold lo_ctl_mutex to close backing file.
* Calling fput holding lo_ctl_mutex triggers a circular
* lock dependency possibility warning as fput can take
* bd_mutex which is usually taken before lo_ctl_mutex.
+ filp_close(filp, NULL);