From 073b1c233a5ff227e9e6cca314640596bc430f65 Mon Sep 17 00:00:00 2001 From: Erez Zadok Date: Sat, 17 Nov 2007 23:27:19 -0500 Subject: [PATCH] Unionfs: update/assign a KERN_* level to all printk statements Also use pr_info() instead of printk(KERN_INFO ...) Signed-off-by: Erez Zadok --- fs/unionfs/commonfops.c | 4 ++-- fs/unionfs/copyup.c | 2 +- fs/unionfs/dentry.c | 18 ++++++++--------- fs/unionfs/file.c | 7 ++++--- fs/unionfs/inode.c | 19 +++++++++-------- fs/unionfs/main.c | 33 +++++++++++++++--------------- fs/unionfs/mmap.c | 2 +- fs/unionfs/rdstate.c | 2 +- fs/unionfs/rename.c | 12 +++++------ fs/unionfs/super.c | 45 ++++++++++++++++++++++------------------- 10 files changed, 76 insertions(+), 68 deletions(-) diff --git a/fs/unionfs/commonfops.c b/fs/unionfs/commonfops.c index 9adec4f7f3..4e5143e6bf 100644 --- a/fs/unionfs/commonfops.c +++ b/fs/unionfs/commonfops.c @@ -836,8 +836,8 @@ long unionfs_ioctl(struct file *file, unsigned int cmd, unsigned long arg) switch (cmd) { case UNIONFS_IOCTL_INCGEN: /* Increment the superblock generation count */ - printk("unionfs: incgen ioctl deprecated; " - "use \"-o remount,incgen\"\n"); + pr_info("unionfs: incgen ioctl deprecated; " + "use \"-o remount,incgen\"\n"); err = -ENOSYS; break; diff --git a/fs/unionfs/copyup.c b/fs/unionfs/copyup.c index 6a40359f94..86fc45cb19 100644 --- a/fs/unionfs/copyup.c +++ b/fs/unionfs/copyup.c @@ -209,7 +209,7 @@ static int __copyup_ndentry(struct dentry *old_lower_dentry, err = args.err; release_lower_nd(&nd, err); } else { - printk(KERN_ERR "unionfs: unknown inode type %d\n", + printk(KERN_CRIT "unionfs: unknown inode type %d\n", old_mode); BUG(); } diff --git a/fs/unionfs/dentry.c b/fs/unionfs/dentry.c index b245034e67..b7e13e37f5 100644 --- a/fs/unionfs/dentry.c +++ b/fs/unionfs/dentry.c @@ -234,17 +234,17 @@ bool is_newer_lower(const struct dentry *dentry) */ if (unlikely(timespec_compare(&inode->i_mtime, &lower_inode->i_mtime) < 0)) { - printk("unionfs: new lower inode mtime " - "(bindex=%d, name=%s)\n", bindex, - dentry->d_name.name); + pr_info("unionfs: new lower inode mtime " + "(bindex=%d, name=%s)\n", bindex, + dentry->d_name.name); show_dinode_times(dentry); return true; /* mtime changed! */ } if (unlikely(timespec_compare(&inode->i_ctime, &lower_inode->i_ctime) < 0)) { - printk("unionfs: new lower inode ctime " - "(bindex=%d, name=%s)\n", bindex, - dentry->d_name.name); + pr_info("unionfs: new lower inode ctime " + "(bindex=%d, name=%s)\n", bindex, + dentry->d_name.name); show_dinode_times(dentry); return true; /* ctime changed! */ } @@ -344,7 +344,7 @@ bool __unionfs_d_revalidate_chain(struct dentry *dentry, struct nameidata *nd, */ chain = kzalloc(chain_len * sizeof(struct dentry *), GFP_KERNEL); if (unlikely(!chain)) { - printk("unionfs: no more memory in %s\n", __FUNCTION__); + printk(KERN_CRIT "unionfs: no more memory in %s\n", __FUNCTION__); goto out; } @@ -465,12 +465,12 @@ static void unionfs_d_release(struct dentry *dentry) unionfs_check_dentry(dentry); /* this could be a negative dentry, so check first */ if (unlikely(!UNIONFS_D(dentry))) { - printk(KERN_DEBUG "unionfs: dentry without private data: %.*s\n", + printk(KERN_ERR "unionfs: dentry without private data: %.*s\n", dentry->d_name.len, dentry->d_name.name); goto out; } else if (dbstart(dentry) < 0) { /* this is due to a failed lookup */ - printk(KERN_DEBUG "unionfs: dentry without lower " + printk(KERN_ERR "unionfs: dentry without lower " "dentries: %.*s\n", dentry->d_name.len, dentry->d_name.name); goto out_free; diff --git a/fs/unionfs/file.c b/fs/unionfs/file.c index 82959d1c8b..923f134317 100644 --- a/fs/unionfs/file.c +++ b/fs/unionfs/file.c @@ -121,12 +121,13 @@ static int unionfs_mmap(struct file *file, struct vm_area_struct *vma) lower_file = unionfs_lower_file(file); if (willwrite && !lower_file->f_mapping->a_ops->writepage) { err = -EINVAL; - printk("unionfs: branch %d file system does not support " - "writeable mmap\n", fbstart(file)); + printk(KERN_ERR "unionfs: branch %d file system does not " + "support writeable mmap\n", fbstart(file)); } else { err = generic_file_mmap(file, vma); if (err) - printk("unionfs: generic_file_mmap failed %d\n", err); + printk(KERN_ERR + "unionfs: generic_file_mmap failed %d\n", err); } out: diff --git a/fs/unionfs/inode.c b/fs/unionfs/inode.c index 219ef591b7..50ca92d057 100644 --- a/fs/unionfs/inode.c +++ b/fs/unionfs/inode.c @@ -371,8 +371,9 @@ static int unionfs_symlink(struct inode *dir, struct dentry *dentry, if (IS_ERR(lower_dentry)) err = PTR_ERR(lower_dentry); - printk(KERN_DEBUG "lower dentry NULL (or error)" - "for bindex = %d\n", bstart); + printk(KERN_ERR "unionfs: lower dentry " + "NULL (or error) for bindex = %d\n", + bstart); goto out; } unionfs_postcopyup_setmnt(dentry->d_parent); @@ -460,8 +461,8 @@ static int unionfs_mkdir(struct inode *parent, struct dentry *dentry, int mode) dentry->d_name.name, bindex); if (!lower_dentry || IS_ERR(lower_dentry)) { - printk(KERN_DEBUG "lower dentry NULL for " - "bindex = %d\n", bindex); + printk(KERN_ERR "unionfs: lower dentry " + " NULL for bindex = %d\n", bindex); err = PTR_ERR(lower_dentry); goto out; } @@ -565,8 +566,8 @@ static int unionfs_mknod(struct inode *dir, struct dentry *dentry, int mode, dentry->d_name.name, bstart); if (IS_ERR(lower_dentry)) { - printk(KERN_DEBUG - "failed to create parents on %d, err = %ld\n", + printk(KERN_ERR "unionfs: failed to create " + "parents on %d, err = %ld\n", bstart, PTR_ERR(lower_dentry)); goto out; } @@ -720,7 +721,8 @@ static void unionfs_put_link(struct dentry *dentry, struct nameidata *nd, unionfs_read_lock(dentry->d_sb); unionfs_lock_dentry(dentry); if (unlikely(!__unionfs_d_revalidate_chain(dentry, nd, false))) - printk("unionfs: put_link failed to revalidate dentry\n"); + printk(KERN_ERR + "unionfs: put_link failed to revalidate dentry\n"); unionfs_unlock_dentry(dentry); unionfs_check_dentry(dentry); @@ -930,7 +932,8 @@ static int unionfs_setattr(struct dentry *dentry, struct iattr *ia) if (ia->ia_size != i_size_read(inode)) { err = vmtruncate(inode, ia->ia_size); if (err) - printk("unionfs: setattr: vmtruncate failed\n"); + printk(KERN_ERR + "unionfs: setattr: vmtruncate failed\n"); } } diff --git a/fs/unionfs/main.c b/fs/unionfs/main.c index 0a90f4f4de..e0c3bcd8b7 100644 --- a/fs/unionfs/main.c +++ b/fs/unionfs/main.c @@ -198,7 +198,7 @@ skip: /* Do nothing. */ break; default: - printk(KERN_ERR "unionfs: invalid interpose flag passed!\n"); + printk(KERN_CRIT "unionfs: invalid interpose flag passed!\n"); BUG(); } goto out; @@ -323,7 +323,7 @@ static int parse_dirs_option(struct super_block *sb, struct unionfs_dentry_info if (options[0] == '\0') { branches = 0; - printk(KERN_WARNING "unionfs: no branches specified\n"); + printk(KERN_ERR "unionfs: no branches specified\n"); err = -EINVAL; goto out; } @@ -378,14 +378,14 @@ static int parse_dirs_option(struct super_block *sb, struct unionfs_dentry_info err = path_lookup(name, LOOKUP_FOLLOW, &nd); if (err) { - printk(KERN_WARNING "unionfs: error accessing " + printk(KERN_ERR "unionfs: error accessing " "lower directory '%s' (error %d)\n", name, err); goto out; } if ((err = check_branch(&nd))) { - printk(KERN_WARNING "unionfs: lower directory " + printk(KERN_ERR "unionfs: lower directory " "'%s' is not a valid branch\n", name); path_release(&nd); goto out; @@ -405,7 +405,7 @@ static int parse_dirs_option(struct super_block *sb, struct unionfs_dentry_info } if (branches == 0) { - printk(KERN_WARNING "unionfs: no branches specified\n"); + printk(KERN_ERR "unionfs: no branches specified\n"); err = -EINVAL; goto out; } @@ -432,7 +432,7 @@ static int parse_dirs_option(struct super_block *sb, struct unionfs_dentry_info for (j = i + 1; j < branches; j++) { dent2 = lower_root_info->lower_paths[j].dentry; if (is_branch_overlap(dent1, dent2)) { - printk(KERN_WARNING "unionfs: branches %d and " + printk(KERN_ERR "unionfs: branches %d and " "%d overlap\n", i, j); err = -EINVAL; goto out; @@ -508,14 +508,15 @@ static struct unionfs_dentry_info *unionfs_parse_options( * that don't, above this check. */ if (!optarg) { - printk("unionfs: %s requires an argument.\n", optname); + printk(KERN_ERR "unionfs: %s requires an argument.\n", + optname); err = -EINVAL; goto out_error; } if (!strcmp("dirs", optname)) { if (++dirsfound > 1) { - printk(KERN_WARNING + printk(KERN_ERR "unionfs: multiple dirs specified\n"); err = -EINVAL; goto out_error; @@ -533,7 +534,7 @@ static struct unionfs_dentry_info *unionfs_parse_options( /* All of these options require an integer argument. */ intval = simple_strtoul(optarg, &endptr, 0); if (*endptr) { - printk(KERN_WARNING + printk(KERN_ERR "unionfs: invalid %s option '%s'\n", optname, optarg); err = -EINVAL; @@ -541,12 +542,12 @@ static struct unionfs_dentry_info *unionfs_parse_options( } err = -EINVAL; - printk(KERN_WARNING + printk(KERN_ERR "unionfs: unrecognized option '%s'\n", optname); goto out_error; } if (dirsfound != 1) { - printk(KERN_WARNING "unionfs: dirs option (not) required\n"); + printk(KERN_ERR "unionfs: dirs option (not) required\n"); err = -EINVAL; goto out_error; } @@ -621,7 +622,7 @@ static int unionfs_read_super(struct super_block *sb, void *raw_data, int *bid = NULL, high_bid; if (!raw_data) { - printk(KERN_WARNING + printk(KERN_ERR "unionfs: read_super: missing data argument\n"); err = -EINVAL; goto out; @@ -630,7 +631,7 @@ static int unionfs_read_super(struct super_block *sb, void *raw_data, /* Allocate superblock private data */ sb->s_fs_info = kzalloc(sizeof(struct unionfs_sb_info), GFP_KERNEL); if (unlikely(!UNIONFS_SB(sb))) { - printk(KERN_WARNING "unionfs: read_super: out of memory\n"); + printk(KERN_CRIT "unionfs: read_super: out of memory\n"); err = -ENOMEM; goto out; } @@ -668,7 +669,7 @@ static int unionfs_read_super(struct super_block *sb, void *raw_data, lower_root_info = unionfs_parse_options(sb, raw_data); if (IS_ERR(lower_root_info)) { - printk(KERN_WARNING + printk(KERN_ERR "unionfs: read_super: error while parsing options " "(err = %ld)\n", PTR_ERR(lower_root_info)); err = PTR_ERR(lower_root_info); @@ -845,7 +846,7 @@ static int __init init_unionfs_fs(void) { int err; - printk("Registering unionfs " UNIONFS_VERSION "\n"); + pr_info("Registering unionfs " UNIONFS_VERSION "\n"); err = unionfs_init_filldir_cache(); if (unlikely(err)) @@ -881,7 +882,7 @@ static void __exit exit_unionfs_fs(void) unionfs_destroy_dentry_cache(); unionfs_config_exit(); unregister_filesystem(&unionfs_fs_type); - printk("Completed unionfs module unload.\n"); + pr_info("Completed unionfs module unload\n"); } MODULE_AUTHOR("Erez Zadok, Filesystems and Storage Lab, Stony Brook University" diff --git a/fs/unionfs/mmap.c b/fs/unionfs/mmap.c index 8928e99905..37ad761621 100644 --- a/fs/unionfs/mmap.c +++ b/fs/unionfs/mmap.c @@ -347,7 +347,7 @@ static void unionfs_sync_page(struct page *page) */ lower_page = find_lock_page(lower_inode->i_mapping, page->index); if (!lower_page) { - printk(KERN_DEBUG "unionfs: find_lock_page failed\n"); + printk(KERN_ERR "unionfs: find_lock_page failed\n"); goto out; } diff --git a/fs/unionfs/rdstate.c b/fs/unionfs/rdstate.c index 3262384635..31c41e796c 100644 --- a/fs/unionfs/rdstate.c +++ b/fs/unionfs/rdstate.c @@ -186,7 +186,7 @@ struct filldir_node *find_filldir_node(struct unionfs_dir_state *rdstate, * system is corrupted. */ if (unlikely(cursor->bindex == rdstate->bindex)) { - printk(KERN_DEBUG "unionfs: filldir: possible " + printk(KERN_ERR "unionfs: filldir: possible " "I/O error: a file is duplicated " "in the same branch %d: %s\n", rdstate->bindex, cursor->name); diff --git a/fs/unionfs/rename.c b/fs/unionfs/rename.c index cfd8e4aa76..ab292d9937 100644 --- a/fs/unionfs/rename.c +++ b/fs/unionfs/rename.c @@ -89,7 +89,7 @@ static int __unionfs_rename(struct inode *old_dir, struct dentry *old_dentry, new_dentry, new_dentry->d_name.name, bindex); if (IS_ERR(lower_new_dentry)) { - printk(KERN_DEBUG "unionfs: error creating directory " + printk(KERN_ERR "unionfs: error creating directory " "tree for rename, bindex = %d, err = %ld\n", bindex, PTR_ERR(lower_new_dentry)); err = PTR_ERR(lower_new_dentry); @@ -257,14 +257,14 @@ revert: /* Do revert here. */ local_err = unionfs_refresh_lower_dentry(new_dentry, old_bstart); if (local_err) { - printk(KERN_WARNING "unionfs: revert failed in rename: " + printk(KERN_ERR "unionfs: revert failed in rename: " "the new refresh failed.\n"); eio = -EIO; } local_err = unionfs_refresh_lower_dentry(old_dentry, old_bstart); if (local_err) { - printk(KERN_WARNING "unionfs: revert failed in rename: " + printk(KERN_ERR "unionfs: revert failed in rename: " "the old refresh failed.\n"); eio = -EIO; goto revert_out; @@ -272,7 +272,7 @@ revert: if (!unionfs_lower_dentry_idx(new_dentry, bindex) || !unionfs_lower_dentry_idx(new_dentry, bindex)->d_inode) { - printk(KERN_WARNING "unionfs: revert failed in rename: " + printk(KERN_ERR "unionfs: revert failed in rename: " "the object disappeared from under us!\n"); eio = -EIO; goto revert_out; @@ -280,7 +280,7 @@ revert: if (unionfs_lower_dentry_idx(old_dentry, bindex) && unionfs_lower_dentry_idx(old_dentry, bindex)->d_inode) { - printk(KERN_WARNING "unionfs: revert failed in rename: " + printk(KERN_ERR "unionfs: revert failed in rename: " "the object was created underneath us!\n"); eio = -EIO; goto revert_out; @@ -291,7 +291,7 @@ revert: /* If we can't fix it, then we cop-out with -EIO. */ if (local_err) { - printk(KERN_WARNING "unionfs: revert failed in rename!\n"); + printk(KERN_ERR "unionfs: revert failed in rename!\n"); eio = -EIO; } diff --git a/fs/unionfs/super.c b/fs/unionfs/super.c index 3b5c38a1ab..acf8c7cc99 100644 --- a/fs/unionfs/super.c +++ b/fs/unionfs/super.c @@ -43,7 +43,7 @@ static void unionfs_read_inode(struct inode *inode) size = sbmax(inode->i_sb) * sizeof(struct inode *); info->lower_inodes = kzalloc(size, GFP_KERNEL); if (unlikely(!info->lower_inodes)) { - printk(KERN_ERR "unionfs: no kernel memory when allocating " + printk(KERN_CRIT "unionfs: no kernel memory when allocating " "lower-pointer array!\n"); BUG(); } @@ -99,7 +99,8 @@ static void unionfs_put_super(struct super_block *sb) /* Make sure we have no leaks of branchget/branchput. */ for (bindex = bstart; bindex <= bend; bindex++) if (unlikely(branch_count(sb, bindex) != 0)) { - printk("unionfs: branch %d has %d references left!\n", + printk(KERN_CRIT + "unionfs: branch %d has %d references left!\n", bindex, branch_count(sb, bindex)); leaks = 1; } @@ -164,17 +165,19 @@ static noinline int do_remount_mode_option(char *optarg, int cur_branches, /* by now, optarg contains the branch name */ if (!*optarg) { - printk("unionfs: no branch specified for mode change.\n"); + printk(KERN_ERR + "unionfs: no branch specified for mode change.\n"); goto out; } if (!modename) { - printk("unionfs: branch \"%s\" requires a mode.\n", optarg); + printk(KERN_ERR "unionfs: branch \"%s\" requires a mode.\n", + optarg); goto out; } *modename++ = '\0'; perms = __parse_branch_mode(modename); if (perms == 0) { - printk("unionfs: invalid mode \"%s\" for \"%s\".\n", + printk(KERN_ERR "unionfs: invalid mode \"%s\" for \"%s\".\n", modename, optarg); goto out; } @@ -187,7 +190,7 @@ static noinline int do_remount_mode_option(char *optarg, int cur_branches, */ err = path_lookup(optarg, LOOKUP_FOLLOW, &nd); if (err) { - printk(KERN_WARNING "unionfs: error accessing " + printk(KERN_ERR "unionfs: error accessing " "lower directory \"%s\" (error %d)\n", optarg, err); goto out; @@ -199,7 +202,7 @@ static noinline int do_remount_mode_option(char *optarg, int cur_branches, path_release(&nd); /* no longer needed */ if (idx == cur_branches) { err = -ENOENT; /* err may have been reset above */ - printk(KERN_WARNING "unionfs: branch \"%s\" " + printk(KERN_ERR "unionfs: branch \"%s\" " "not found\n", optarg); goto out; } @@ -230,7 +233,7 @@ static noinline int do_remount_del_option(char *optarg, int cur_branches, */ err = path_lookup(optarg, LOOKUP_FOLLOW, &nd); if (err) { - printk(KERN_WARNING "unionfs: error accessing " + printk(KERN_ERR "unionfs: error accessing " "lower directory \"%s\" (error %d)\n", optarg, err); goto out; @@ -241,7 +244,7 @@ static noinline int do_remount_del_option(char *optarg, int cur_branches, break; path_release(&nd); /* no longer needed */ if (idx == cur_branches) { - printk(KERN_WARNING "unionfs: branch \"%s\" " + printk(KERN_ERR "unionfs: branch \"%s\" " "not found\n", optarg); err = -ENOENT; goto out; @@ -314,7 +317,7 @@ static noinline int do_remount_add_option(char *optarg, int cur_branches, */ err = path_lookup(optarg, LOOKUP_FOLLOW, &nd); if (err) { - printk(KERN_WARNING "unionfs: error accessing " + printk(KERN_ERR "unionfs: error accessing " "lower directory \"%s\" (error %d)\n", optarg, err); goto out; @@ -325,7 +328,7 @@ static noinline int do_remount_add_option(char *optarg, int cur_branches, break; path_release(&nd); /* no longer needed */ if (idx == cur_branches) { - printk(KERN_WARNING "unionfs: branch \"%s\" " + printk(KERN_ERR "unionfs: branch \"%s\" " "not found\n", optarg); err = -ENOENT; goto out; @@ -344,13 +347,13 @@ found_insertion_point: perms = parse_branch_mode(modename); if (!new_branch || !*new_branch) { - printk(KERN_WARNING "unionfs: null new branch\n"); + printk(KERN_ERR "unionfs: null new branch\n"); err = -EINVAL; goto out; } err = path_lookup(new_branch, LOOKUP_FOLLOW, &nd); if (err) { - printk(KERN_WARNING "unionfs: error accessing " + printk(KERN_ERR "unionfs: error accessing " "lower directory \"%s\" (error %d)\n", new_branch, err); goto out; @@ -363,7 +366,7 @@ found_insertion_point: * code base supports that correctly. */ if ((err = check_branch(&nd))) { - printk(KERN_WARNING "unionfs: lower directory " + printk(KERN_ERR "unionfs: lower directory " "\"%s\" is not a valid branch\n", optarg); path_release(&nd); goto out; @@ -449,7 +452,7 @@ static int unionfs_remount_fs(struct super_block *sb, int *flags, * allowed/supported as of now). */ if ((*flags & ~(MS_RDONLY | MS_SILENT)) != 0) { - printk(KERN_WARNING + printk(KERN_ERR "unionfs: remount flags 0x%x unsupported\n", *flags); err = -EINVAL; goto out_error; @@ -494,7 +497,7 @@ static int unionfs_remount_fs(struct super_block *sb, int *flags, kfree(tmp_to_free); /* after all changes, will we have at least one branch left? */ if ((new_branches + add_branches - del_branches) < 1) { - printk(KERN_WARNING + printk(KERN_ERR "unionfs: no branches left after remount\n"); err = -EINVAL; goto out_free; @@ -586,7 +589,7 @@ static int unionfs_remount_fs(struct super_block *sb, int *flags, * contains the CMD part and optarg contains the ARG part. */ if (!optarg || !*optarg) { - printk("unionfs: all remount options require " + printk(KERN_ERR "unionfs: all remount options require " "an argument (%s).\n", optname); err = -EINVAL; goto out_release; @@ -601,7 +604,7 @@ static int unionfs_remount_fs(struct super_block *sb, int *flags, goto out_release; new_branches++; if (new_branches > UNIONFS_MAX_BRANCHES) { - printk("unionfs: command exceeds " + printk(KERN_ERR "unionfs: command exceeds " "%d branches\n", UNIONFS_MAX_BRANCHES); err = -E2BIG; goto out_release; @@ -643,7 +646,7 @@ static int unionfs_remount_fs(struct super_block *sb, int *flags, } err = -EINVAL; - printk(KERN_WARNING + printk(KERN_ERR "unionfs: unrecognized option \"%s\"\n", optname); goto out_release; } @@ -659,7 +662,7 @@ out_no_change: *******************************************************************/ if (!(tmp_data[0].branchperms & MAY_WRITE)) { - printk("unionfs: leftmost branch cannot be read-only " + printk(KERN_ERR "unionfs: leftmost branch cannot be read-only " "(use \"remount,ro\" to create a read-only union)\n"); err = -EINVAL; goto out_release; @@ -798,7 +801,7 @@ out_no_change: atomic_set(&UNIONFS_D(sb->s_root)->generation, i); atomic_set(&UNIONFS_I(sb->s_root->d_inode)->generation, i); if (!(*flags & MS_SILENT)) - printk("unionfs: new generation number %d\n", i); + pr_info("unionfs: new generation number %d\n", i); /* finally, update the root dentry's times */ unionfs_copy_attr_times(sb->s_root->d_inode); err = 0; /* reset to success */ -- 2.43.0