diff options
author | Stefan Schaeckeler <schaecsn@gmx.net> | 2021-10-09 21:22:39 -0700 |
---|---|---|
committer | Richard Weinberger <richard@nod.at> | 2021-12-23 20:23:42 +0100 |
commit | 2e3cbf425804fb44a005e252f88f93dff108c911 (patch) | |
tree | e8834e956a27afa66eef1dc7faaa4136836b1057 /fs/ubifs/super.c | |
parent | 3fea4d9d160186617ff40490ae01f4f4f36b28ff (diff) | |
download | linux-2e3cbf425804fb44a005e252f88f93dff108c911.tar.gz linux-2e3cbf425804fb44a005e252f88f93dff108c911.tar.bz2 linux-2e3cbf425804fb44a005e252f88f93dff108c911.zip |
ubifs: Export filesystem error counters
Not all ubifs filesystem errors are propagated to userspace.
Export bad magic, bad node and crc errors via sysfs. This allows userspace
to notice filesystem errors:
/sys/fs/ubifs/ubiX_Y/errors_magic
/sys/fs/ubifs/ubiX_Y/errors_node
/sys/fs/ubifs/ubiX_Y/errors_crc
The counters are reset to 0 with a remount.
Signed-off-by: Stefan Schaeckeler <sschaeck@cisco.com>
Signed-off-by: Richard Weinberger <richard@nod.at>
Diffstat (limited to 'fs/ubifs/super.c')
-rw-r--r-- | fs/ubifs/super.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/fs/ubifs/super.c b/fs/ubifs/super.c index fbec8fcc9a3c..aa7a1381c457 100644 --- a/fs/ubifs/super.c +++ b/fs/ubifs/super.c @@ -1264,6 +1264,10 @@ static int mount_ubifs(struct ubifs_info *c) if (err) return err; + err = ubifs_sysfs_register(c); + if (err) + goto out_debugging; + err = check_volume_empty(c); if (err) goto out_free; @@ -1640,6 +1644,8 @@ out_free: vfree(c->sbuf); kfree(c->bottom_up_buf); kfree(c->sup_node); + ubifs_sysfs_unregister(c); +out_debugging: ubifs_debugging_exit(c); return err; } @@ -1683,6 +1689,7 @@ static void ubifs_umount(struct ubifs_info *c) kfree(c->bottom_up_buf); kfree(c->sup_node); ubifs_debugging_exit(c); + ubifs_sysfs_unregister(c); } /** @@ -2433,14 +2440,20 @@ static int __init ubifs_init(void) dbg_debugfs_init(); + err = ubifs_sysfs_init(); + if (err) + goto out_dbg; + err = register_filesystem(&ubifs_fs_type); if (err) { pr_err("UBIFS error (pid %d): cannot register file system, error %d", current->pid, err); - goto out_dbg; + goto out_sysfs; } return 0; +out_sysfs: + ubifs_sysfs_exit(); out_dbg: dbg_debugfs_exit(); ubifs_compressors_exit(); @@ -2459,6 +2472,7 @@ static void __exit ubifs_exit(void) WARN_ON(atomic_long_read(&ubifs_clean_zn_cnt) != 0); dbg_debugfs_exit(); + ubifs_sysfs_exit(); ubifs_compressors_exit(); unregister_shrinker(&ubifs_shrinker_info); |