Thread (54 messages) 54 messages, 4 authors, 2021-08-19

Re: [PATCH v6 17/21] fanotify: Report fid info for file related file system errors

From: Jan Kara <jack@suse.cz>
Date: 2021-08-16 16:18:35
Also in: linux-api, linux-fsdevel

On Thu 12-08-21 17:40:06, Gabriel Krisman Bertazi wrote:
Plumb the pieces to add a FID report to error records.  Since all error
event memory must be pre-allocated, we estimate a file handle size and
if it is insuficient, we report an invalid FID and increase the
prediction for the next error slot allocation.
This needs updating. The code now uses MAX_HANDLE_SZ...
 
quoted hunk ↗ jump to hunk
For errors that don't expose a file handle report it with an invalid
FID.

Signed-off-by: Gabriel Krisman Bertazi <redacted>

---
Changes since v5:
  - Use preallocated MAX_HANDLE_SZ FH buffer
  - Report superblock errors with a zerolength INVALID FID (jan, amir)
---
 fs/notify/fanotify/fanotify.c      | 15 +++++++++++++++
 fs/notify/fanotify/fanotify.h      | 11 +++++++++++
 fs/notify/fanotify/fanotify_user.c |  7 +++++++
 3 files changed, 33 insertions(+)
diff --git a/fs/notify/fanotify/fanotify.c b/fs/notify/fanotify/fanotify.c
index 0c7667d3f5d1..f5c16ac37835 100644
--- a/fs/notify/fanotify/fanotify.c
+++ b/fs/notify/fanotify/fanotify.c
@@ -734,6 +734,8 @@ static int fanotify_handle_error_event(struct fsnotify_iter_info *iter_info,
 	struct fanotify_sb_mark *sb_mark =
 		FANOTIFY_SB_MARK(fsnotify_iter_sb_mark(iter_info));
 	struct fanotify_error_event *fee = sb_mark->fee_slot;
+	struct inode *inode = report->inode;
+	int fh_len;
 
 	spin_lock(&group->notification_lock);
 	if (fee->err_count++) {
@@ -743,6 +745,19 @@ static int fanotify_handle_error_event(struct fsnotify_iter_info *iter_info,
 	spin_unlock(&group->notification_lock);
 
 	fee->fae.type = FANOTIFY_EVENT_TYPE_FS_ERROR;
+	fee->fsid = fee->sb_mark->fsn_mark.connector->fsid;
Why don't you use sb_mark directly?

Otherwise the patch looks good to me.

								Honza
-- 
Jan Kara [off-list ref]
SUSE Labs, CR
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help