Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1667420

[PATCH 1/2] loop: use filp_close() rather than fput()

From NeilBrown <neilb@suse.com>
Newsgroups linux.kernel
Subject [PATCH 1/2] loop: use filp_close() rather than fput()
Date 2017-06-16 07:10 +0200
Message-ID <tSRG9-460-1@gated-at.bofh.it> (permalink)
References <tSRG9-460-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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@suse.com>
---
 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
--- a/drivers/block/loop.c
+++ b/drivers/block/loop.c
@@ -682,7 +682,7 @@ static int loop_change_fd(struct loop_device *lo, struct block_device *bdev,
 	if (error)
 		goto out_putf;
 
-	fput(old_file);
+	filp_close(old_file, NULL);
 	if (lo->lo_flags & LO_FLAGS_PARTSCAN)
 		loop_reread_partitions(lo, bdev);
 	return 0;
@@ -1071,12 +1071,12 @@ static int loop_clr_fd(struct loop_device *lo)
 	loop_unprepare_queue(lo);
 	mutex_unlock(&lo->lo_ctl_mutex);
 	/*
-	 * 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.
 	 */
-	fput(filp);
+	filp_close(filp, NULL);
 	return 0;
 }
 

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

[PATCH 1/2] loop: use filp_close() rather than fput() NeilBrown <neilb@suse.com> - 2017-06-16 07:10 +0200
  Re: [PATCH 1/2] loop: use filp_close() rather than fput() Christoph Hellwig <hch@infradead.org> - 2017-06-16 09:40 +0200
  Re: [PATCH 1/2] loop: use filp_close() rather than fput() Al Viro <viro@ZenIV.linux.org.uk> - 2017-06-17 02:10 +0200
    Re: [PATCH 1/2] loop: use filp_close() rather than fput() NeilBrown <neilb@suse.com> - 2017-06-18 06:40 +0200

csiph-web