mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Tvrtko Ursulin <tvrtko.ursulin@sophos.com>
To: Eric Paris <eparis@redhat.com>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-fsdevel@vger.kernel.org" <linux-fsdevel@vger.kernel.org>
Subject: [PATCH] Avoid having to provide a fake/invalid fd and path when flushing marks
Date: Wed, 12 Jan 2011 12:13:57 +0000	[thread overview]
Message-ID: <201101121213.58639.tvrtko.ursulin@sophos.com> (raw)

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


(Patch also attached in case our outgoing mail servers decide
to munge tabs again.)

Currently for a group to flush marks it has set it needs to
provide a fake or invalid (but resolvable) file descriptor
and path when calling fanotify_mark. This patch pulls the
flush handling a bit up so file descriptor and path are
completely ignored when flushing.

Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@sophos.com>
---
 fanotify_user.c |   15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/fs/notify/fanotify/fanotify_user.c b/fs/notify/fanotify/fanotify_user.c
index 8b61220..09504b1 100644
--- a/fs/notify/fanotify/fanotify_user.c
+++ b/fs/notify/fanotify/fanotify_user.c
@@ -824,6 +824,15 @@ SYSCALL_DEFINE(fanotify_mark)(int fanotify_fd, unsigned int flags,
            group->priority == FS_PRIO_0)
                goto fput_and_out;

+       if (flags & FAN_MARK_FLUSH) {
+               if (flags & FAN_MARK_MOUNT)
+                       fsnotify_clear_vfsmount_marks_by_group(group);
+               else
+                       fsnotify_clear_inode_marks_by_group(group);
+               ret = 0;
+               goto fput_and_out;
+       }
+
        ret = fanotify_find_path(dfd, pathname, &path, flags);
        if (ret)
                goto fput_and_out;
@@ -848,12 +857,6 @@ SYSCALL_DEFINE(fanotify_mark)(int fanotify_fd, unsigned int flags,
                else
                        ret = fanotify_remove_inode_mark(group, inode, mask, flags);
                break;
-       case FAN_MARK_FLUSH:
-               if (flags & FAN_MARK_MOUNT)
-                       fsnotify_clear_vfsmount_marks_by_group(group);
-               else
-                       fsnotify_clear_inode_marks_by_group(group);
-               break;
        default:
                ret = -EINVAL;
        }

Sophos Limited, The Pentagon, Abingdon Science Park, Abingdon, OX14 3YP, United Kingdom.
Company Reg No 2096520. VAT Reg No GB 991 2418 08.

[-- Attachment #2: fanotify-flush-marks.patch --]
[-- Type: text/x-patch, Size: 1020 bytes --]

diff --git a/fs/notify/fanotify/fanotify_user.c b/fs/notify/fanotify/fanotify_user.c
index 8b61220..09504b1 100644
--- a/fs/notify/fanotify/fanotify_user.c
+++ b/fs/notify/fanotify/fanotify_user.c
@@ -824,6 +824,15 @@ SYSCALL_DEFINE(fanotify_mark)(int fanotify_fd, unsigned int flags,
 	    group->priority == FS_PRIO_0)
 		goto fput_and_out;
 
+	if (flags & FAN_MARK_FLUSH) {
+		if (flags & FAN_MARK_MOUNT)
+			fsnotify_clear_vfsmount_marks_by_group(group);
+		else
+			fsnotify_clear_inode_marks_by_group(group);
+		ret = 0;
+		goto fput_and_out;
+	}
+
 	ret = fanotify_find_path(dfd, pathname, &path, flags);
 	if (ret)
 		goto fput_and_out;
@@ -848,12 +857,6 @@ SYSCALL_DEFINE(fanotify_mark)(int fanotify_fd, unsigned int flags,
 		else
 			ret = fanotify_remove_inode_mark(group, inode, mask, flags);
 		break;
-	case FAN_MARK_FLUSH:
-		if (flags & FAN_MARK_MOUNT)
-			fsnotify_clear_vfsmount_marks_by_group(group);
-		else
-			fsnotify_clear_inode_marks_by_group(group);
-		break;
 	default:
 		ret = -EINVAL;
 	}

             reply	other threads:[~2011-01-12 12:14 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-12 12:13 Tvrtko Ursulin [this message]
2011-01-19 20:45 ` Eric Paris

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=201101121213.58639.tvrtko.ursulin@sophos.com \
    --to=tvrtko.ursulin@sophos.com \
    --cc=eparis@redhat.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®