@@ -3516,12 +3516,14 @@ static inline void notify_sb(struct super_block *s,
/**
* notify_sb_error: Post superblock error notification.
* @s: The superblock the notification is about.
+ * @function: function name reported as source of the warning.
+ * @line: source code line reported as source of the warning.
* @error: The error number to be recorded.
* @fmt: Formating string for extra information appended to the notification
* @args: arguments for extra information string appended to the notification
*/
-static inline int notify_sb_error(struct super_block *s, int error,
- const char *fmt, va_list *args)
+static inline int notify_sb_error(struct super_block *s, const char *function,
+ int line, int error, const char *fmt, va_list *args)
{
#ifdef CONFIG_SB_NOTIFICATIONS
if (unlikely(s->s_watchers)) {
@@ -3532,8 +3534,12 @@ static inline int notify_sb_error(struct super_block *s, int error,
.s.sb_id = s->s_unique_id,
.error_number = error,
.error_cookie = 0,
+ .line = line,
};
+ memcpy(&n.function, function, SB_NOTIFICATION_FNAME_LEN);
+ n.function[SB_NOTIFICATION_FNAME_LEN-1] = '\0';
+
post_sb_notification(s, &n.s, fmt, args);
}
#endif
@@ -114,6 +114,7 @@ enum superblock_notification_type {
#define NOTIFY_SUPERBLOCK_IS_NOW_RO WATCH_INFO_FLAG_0 /* Superblock changed to R/O */
+#define SB_NOTIFICATION_FNAME_LEN 30
/*
* Superblock notification record.
* - watch.type = WATCH_TYPE_MOUNT_NOTIFY
@@ -128,6 +129,8 @@ struct superblock_error_notification {
struct superblock_notification s; /* subtype = notify_superblock_error */
__u32 error_number;
__u32 error_cookie;
+ char function[SB_NOTIFICATION_FNAME_LEN];
+ __u16 line;
char desc[0];
};
When reporting a filesystem error, we really need to know where the error came from, therefore, include "function:line" information in the notification sent to userspace. There is no current users of notify_sb in the kernel, so there are no callers to update. Signed-off-by: Gabriel Krisman Bertazi <krisman@collabora.com> --- include/linux/fs.h | 10 ++++++++-- include/uapi/linux/watch_queue.h | 3 +++ 2 files changed, 11 insertions(+), 2 deletions(-)