linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH resend] vfs: allow FILE_EXTENT_SAME (dedupe_file_range) on a file opened ro
@ 2016-10-05 14:38 Adam Borowski
  2016-10-12 22:15 ` ping howto (was Re: [PATCH resend] vfs: allow FILE_EXTENT_SAME (dedupe_file_range) on a file opened ro) Adam Borowski
  0 siblings, 1 reply; 2+ messages in thread
From: Adam Borowski @ 2016-10-05 14:38 UTC (permalink / raw)
  To: Alexander Viro, linux-fsdevel, linux-kernel; +Cc: Adam Borowski

Instead of checking the mode of the file descriptor, let's check whether it
could have been opened rw.  This allows fixing intermittent exec failures
when deduping a live system: anyone trying to exec a file currently being
deduped gets ETXTBSY.

Issuing this ioctl on a ro file was already allowed for root/cap.

Tested on btrfs and not-yet-merged xfs, as only them implement this ioctl.

Signed-off-by: Adam Borowski <kilobyte@angband.pl>
Reviewed-by: Mark Fasheh <mfasheh@suse.de>
---
 fs/read_write.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/read_write.c b/fs/read_write.c
index 66215a7..8ea5297 100644
--- a/fs/read_write.c
+++ b/fs/read_write.c
@@ -1741,7 +1741,7 @@ int vfs_dedupe_file_range(struct file *file, struct file_dedupe_range *same)
 
 		if (info->reserved) {
 			info->status = -EINVAL;
-		} else if (!(is_admin || (dst_file->f_mode & FMODE_WRITE))) {
+		} else if (!(is_admin || !inode_permission(dst, MAY_WRITE))) {
 			info->status = -EINVAL;
 		} else if (file->f_path.mnt != dst_file->f_path.mnt) {
 			info->status = -EXDEV;
-- 
2.9.3


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* ping howto (was Re: [PATCH resend] vfs: allow FILE_EXTENT_SAME (dedupe_file_range) on a file opened ro)
  2016-10-05 14:38 [PATCH resend] vfs: allow FILE_EXTENT_SAME (dedupe_file_range) on a file opened ro Adam Borowski
@ 2016-10-12 22:15 ` Adam Borowski
  0 siblings, 0 replies; 2+ messages in thread
From: Adam Borowski @ 2016-10-12 22:15 UTC (permalink / raw)
  To: Alexander Viro, linux-fsdevel, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 1100 bytes --]

On Wed, Oct 05, 2016 at 04:38:54PM +0200, Adam Borowski wrote:
> [fix for dedupe-vs-exec ETXTBSY]
> Reviewed-by: Mark Fasheh <mfasheh@suse.de>

Hi guys!
May I ask if I'm doing something wrong, or barking up the wrong tree?  I've
sent this patch thrice (May 20, Jul 18, Oct 5), pinged once (Aug 6), yet it
hasn't been taken nor NACKed yet.  For fixes to vfs core I need to bother Al
Viro, -fsdevel@vger, -kernel@vger, right?

It's not a vital fix (strictly speaking, it only allows to fix userspace),
as save for unprivileged containers, when deduping executables you usually
need to be root anyway -- but it'd still be nice to have it.  It has been
ACKed by the original author of that code.

(Sorry for being annoying, I got only 13 commits elsewhere in the kernel so
please point me in the right direction when hitting :p)

Meow!
-- 
A MAP07 (Dead Simple) raspberry tincture recipe: 0.5l 95% alcohol, 1kg
raspberries, 0.4kg sugar; put into a big jar for 1 month.  Filter out and
throw away the fruits (can dump them into a cake, etc), let the drink age
at least 3-6 months.

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-10-12 22:15 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-10-05 14:38 [PATCH resend] vfs: allow FILE_EXTENT_SAME (dedupe_file_range) on a file opened ro Adam Borowski
2016-10-12 22:15 ` ping howto (was Re: [PATCH resend] vfs: allow FILE_EXTENT_SAME (dedupe_file_range) on a file opened ro) Adam Borowski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).