Re: [PATCH v2 2/5] ntfs: report attribute errors to fsnotify
From: liubaolin
Date: Thu Sep 17 2026 - 00:22:31 EST
在 2026/9/16 15:38, Hyunchul Lee 写道:
Hi Baolin,Hi Hyunchul,
folio_err_out:
@@ -3720,7 +3737,8 @@ static int ntfs_attr_update_meta(struct attr_record *a, struct ntfs_inode *ni,
static int __ntfs_attr_update_mapping_pairs(struct ntfs_inode *ni,
s64 from_vcn,
struct ntfs_inode *locked_ni,
- bool defer_attrlist)
+ bool defer_attrlist,
+ bool *error_reported)
{
struct ntfs_attr_search_ctx *ctx;
struct ntfs_inode *base_ni;
@@ -4086,8 +4104,11 @@ static int __ntfs_attr_update_mapping_pairs(struct ntfs_inode *ni,
return 0;
put_err_out:
- if (ctx)
+ if (ctx) {
+ if (error_reported && ctx->error_reported)
+ *error_reported = true;
ntfs_attr_put_search_ctx(ctx);
+ }
return err;
}
__ntfs_attr_update_mapping_pairs() does:
ntfs_attr_put_search_ctx(ctx);
ctx = NULL
Therefore any later mapping or other errors can therefore lose report
state and duplicate reports. And The error_reported boolean only tell
us that some lower-level path has already emitted an error. Consequently
a report can incorrectly suppress a separate report for a later rollback
or resotre failure, even though that failure represents an independant
filesystem integrity problem.
Instead of carrying error_reported, would it be simpler to report each
error at its detection point and let fanofify merge repeated error
events? or would there be any alternatives?
Thanks for the feedback. I agree that reporting errors at their detection points and relying on fanotify's event merging is simpler. I'll update the series accordingly and send v3.
Thanks,
Baolin.