Add samsung specific changes
This commit is contained in:
@@ -37,16 +37,11 @@
|
||||
#include "internal.h"
|
||||
#include <trace/hooks/blk.h>
|
||||
|
||||
#ifdef CONFIG_PROC_STLOG
|
||||
#include <linux/fslog.h>
|
||||
#endif
|
||||
#include <trace/hooks/fs.h>
|
||||
|
||||
/* Maximum number of mounts in a mount namespace */
|
||||
static unsigned int sysctl_mount_max __read_mostly = 100000;
|
||||
|
||||
static unsigned int sys_umount_trace_status;
|
||||
|
||||
static unsigned int m_hash_mask __read_mostly;
|
||||
static unsigned int m_hash_shift __read_mostly;
|
||||
static unsigned int mp_hash_mask __read_mostly;
|
||||
@@ -125,68 +120,6 @@ static inline struct hlist_head *m_hash(struct vfsmount *mnt, struct dentry *den
|
||||
return &mount_hashtable[tmp & m_hash_mask];
|
||||
}
|
||||
|
||||
enum {
|
||||
UMOUNT_STATUS_ADD_TASK = 0,
|
||||
UMOUNT_STATUS_REMAIN_NS,
|
||||
UMOUNT_STATUS_REMAIN_MNT_COUNT,
|
||||
UMOUNT_STATUS_ADD_DELAYED_WORK,
|
||||
UMOUNT_STATUS_MAX
|
||||
};
|
||||
|
||||
static inline void sys_umount_trace_set_status(unsigned int status)
|
||||
{
|
||||
sys_umount_trace_status = status;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_PROC_STLOG
|
||||
static const char *umount_exit_str[UMOUNT_STATUS_MAX] = {
|
||||
"ADDED_TASK", "REMAIN_NS", "REMAIN_CNT", "DELAY_TASK"
|
||||
};
|
||||
|
||||
static const char *exception_process[] = {
|
||||
"main", "ch_zygote", "usap32", "usap64", NULL,
|
||||
};
|
||||
|
||||
static inline int is_exception(char *comm)
|
||||
{
|
||||
unsigned int idx = 0;
|
||||
|
||||
do {
|
||||
if (!strcmp(comm, exception_process[idx]))
|
||||
return 1;
|
||||
} while (exception_process[++idx]);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline void sys_umount_trace_print(struct mount *mnt, int flags)
|
||||
{
|
||||
struct super_block *sb = mnt->mnt.mnt_sb;
|
||||
int mnt_flags = mnt->mnt.mnt_flags;
|
||||
|
||||
#ifndef NTFS3_SUPER_MAGIC
|
||||
#define NTFS3_SUPER_MAGIC (0x7366746EUL)
|
||||
#endif /* NTFS3_SUPER_MAGIC */
|
||||
/* We don`t want to see what zygote`s umount */
|
||||
if (((sb->s_magic == MSDOS_SUPER_MAGIC) ||
|
||||
(sb->s_magic == EXFAT_SUPER_MAGIC) ||
|
||||
(sb->s_magic == NTFS3_SUPER_MAGIC)) &&
|
||||
((current_uid().val == 0) && !is_exception(current->comm))) {
|
||||
struct block_device *bdev = sb->s_bdev;
|
||||
dev_t bd_dev = bdev ? bdev->bd_dev : 0;
|
||||
|
||||
ST_LOG("[SYS](%s[%d:%d]): umount(mf:0x%x, f:0x%x, %s)\n",
|
||||
sb->s_id, MAJOR(bd_dev), MINOR(bd_dev), mnt_flags,
|
||||
flags, umount_exit_str[sys_umount_trace_status]);
|
||||
}
|
||||
}
|
||||
#else
|
||||
static inline void sys_umount_trace_print(__always_unused struct mount *mnt,
|
||||
__always_unused int flags)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
static inline struct hlist_head *mp_hash(struct dentry *dentry)
|
||||
{
|
||||
unsigned long tmp = ((unsigned long)dentry / L1_CACHE_BYTES);
|
||||
@@ -1360,7 +1293,6 @@ static void mntput_no_expire(struct mount *mnt)
|
||||
*/
|
||||
mnt_add_count(mnt, -1);
|
||||
rcu_read_unlock();
|
||||
sys_umount_trace_set_status(UMOUNT_STATUS_REMAIN_NS);
|
||||
return;
|
||||
}
|
||||
lock_mount_hash();
|
||||
@@ -1375,7 +1307,6 @@ static void mntput_no_expire(struct mount *mnt)
|
||||
WARN_ON(count < 0);
|
||||
rcu_read_unlock();
|
||||
unlock_mount_hash();
|
||||
sys_umount_trace_set_status(UMOUNT_STATUS_REMAIN_MNT_COUNT);
|
||||
return;
|
||||
}
|
||||
if (unlikely(mnt->mnt.mnt_flags & MNT_DOOMED)) {
|
||||
@@ -1402,15 +1333,11 @@ static void mntput_no_expire(struct mount *mnt)
|
||||
struct task_struct *task = current;
|
||||
if (likely(!(task->flags & PF_KTHREAD))) {
|
||||
init_task_work(&mnt->mnt_rcu, __cleanup_mnt);
|
||||
if (!task_work_add(task, &mnt->mnt_rcu, TWA_RESUME)) {
|
||||
sys_umount_trace_set_status(UMOUNT_STATUS_ADD_TASK);
|
||||
if (!task_work_add(task, &mnt->mnt_rcu, TWA_RESUME))
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (llist_add(&mnt->mnt_llist, &delayed_mntput_list)) {
|
||||
if (llist_add(&mnt->mnt_llist, &delayed_mntput_list))
|
||||
schedule_delayed_work(&delayed_mntput_work, 1);
|
||||
sys_umount_trace_set_status(UMOUNT_STATUS_ADD_DELAYED_WORK);
|
||||
}
|
||||
return;
|
||||
}
|
||||
cleanup_mnt(mnt);
|
||||
@@ -1972,8 +1899,6 @@ int path_umount(struct path *path, int flags)
|
||||
/* we mustn't call path_put() as that would clear mnt_expiry_mark */
|
||||
dput(path->dentry);
|
||||
mntput_no_expire(mnt);
|
||||
if (!ret)
|
||||
sys_umount_trace_print(mnt, flags);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user