]>
git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blob - fs/aufs/sysrq.c
2 * Copyright (C) 2005-2017 Junjiro R. Okajima
4 * This program, aufs is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
22 /* #include <linux/sysrq.h> */
23 #include <linux/writeback.h>
26 /* ---------------------------------------------------------------------- */
28 static void sysrq_sb(struct super_block
*sb
)
31 struct au_sbinfo
*sbinfo
;
33 struct au_sphlhead
*files
;
34 struct au_finfo
*finfo
;
37 au_plevel
= KERN_WARNING
;
39 /* since we define pr_fmt, call printk directly */
40 #define pr(str) printk(KERN_WARNING AUFS_NAME ": " str)
43 printk(KERN_WARNING
"si=%lx\n", sysaufs_si_id(sbinfo
));
49 au_dpri_dentry(sb
->s_root
);
51 au_dpri_inode(d_inode(sb
->s_root
));
56 int err
, i
, j
, ndentry
;
57 struct au_dcsub_pages dpages
;
58 struct au_dpage
*dpage
;
60 err
= au_dpages_init(&dpages
, GFP_ATOMIC
);
63 err
= au_dcsub_pages(&dpages
, sb
->s_root
, NULL
, NULL
);
65 for (i
= 0; i
< dpages
.ndpage
; i
++) {
66 dpage
= dpages
.dpages
+ i
;
67 ndentry
= dpage
->ndentry
;
68 for (j
= 0; j
< ndentry
; j
++)
69 au_dpri_dentry(dpage
->dentries
[j
]);
71 au_dpages_free(&dpages
);
79 pr("isolated inode\n");
80 spin_lock(&sb
->s_inode_list_lock
);
81 list_for_each_entry(i
, &sb
->s_inodes
, i_sb_list
) {
82 spin_lock(&i
->i_lock
);
83 if (1 || hlist_empty(&i
->i_dentry
))
85 spin_unlock(&i
->i_lock
);
87 spin_unlock(&sb
->s_inode_list_lock
);
91 files
= &au_sbi(sb
)->si_files
;
92 spin_lock(&files
->spin
);
93 hlist_for_each_entry(finfo
, &files
->head
, fi_hlist
) {
96 file
= finfo
->fi_file
;
97 mode
= file_inode(file
)->i_mode
;
98 if (!special_file(mode
))
101 spin_unlock(&files
->spin
);
108 /* ---------------------------------------------------------------------- */
110 /* module parameter */
111 static char *aufs_sysrq_key
= "a";
112 module_param_named(sysrq
, aufs_sysrq_key
, charp
, S_IRUGO
);
113 MODULE_PARM_DESC(sysrq
, "MagicSysRq key for " AUFS_NAME
);
115 static void au_sysrq(int key __maybe_unused
)
117 struct au_sbinfo
*sbinfo
;
121 hlist_for_each_entry(sbinfo
, &au_sbilist
.head
, si_list
)
122 sysrq_sb(sbinfo
->si_sb
);
127 static struct sysrq_key_op au_sysrq_op
= {
130 .action_msg
= "Aufs",
131 .enable_mask
= SYSRQ_ENABLE_DUMP
134 /* ---------------------------------------------------------------------- */
136 int __init
au_sysrq_init(void)
142 key
= *aufs_sysrq_key
;
143 if ('a' <= key
&& key
<= 'z')
144 err
= register_sysrq_key(key
, &au_sysrq_op
);
146 pr_err("err %d, sysrq=%c\n", err
, key
);
150 void au_sysrq_fin(void)
154 err
= unregister_sysrq_key(*aufs_sysrq_key
, &au_sysrq_op
);
156 pr_err("err %d (ignored)\n", err
);