-----BEGIN PGP SIGNATURE----- iQEzBAABCAAdFiEEq1nRK9aeMoq1VSgcnJ2qBz9kQNkFAmAzolwACgkQnJ2qBz9k QNnwAQgAhw7PYZgRGnhm/VEDBD1EiPqNIhV3+EuUcNHlrNERx0jPN3bcoXmJD7FE PCCwbsYtQyqjYFipuzvBnUur5s7CxrwyDhvE8bgYdOB43Gy94awwvwF+JbMnBaPj gZSvArKD7ISAUpt560jtH5KedNAZnDkPITePME2GQsOpZ9SHHjsJEhSheTaHk0t1 03Odx6gK5CcRvRD4KQYTa/hvZH95dVHSdakgFODAUoyfR65KMLhBihNOVHZsEVEZ S99j0YBY15nxS8ygo+Iz3Y3KOzy9G1xRAzk3wSeDGzhNRfzYP/IIZWWY/KWowmvH afx0pa0KiYjgqDpDjsyYPOJ2Ul4cPA== =gXlh -----END PGP SIGNATURE----- Merge tag 'fsnotify_for_v5.12-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs Pull fsnotify update from Jan Kara: "Make inotify groups be charged against appropriate memcgs" * tag 'fsnotify_for_v5.12-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs: inotify, memcg: account inotify instances to kmemcg
This commit is contained in:
commit
db99038542
|
@ -976,7 +976,7 @@ SYSCALL_DEFINE2(fanotify_init, unsigned int, flags, unsigned int, event_f_flags)
|
||||||
f_flags |= O_NONBLOCK;
|
f_flags |= O_NONBLOCK;
|
||||||
|
|
||||||
/* fsnotify_alloc_group takes a ref. Dropped in fanotify_release */
|
/* fsnotify_alloc_group takes a ref. Dropped in fanotify_release */
|
||||||
group = fsnotify_alloc_group(&fanotify_fsnotify_ops);
|
group = fsnotify_alloc_user_group(&fanotify_fsnotify_ops);
|
||||||
if (IS_ERR(group)) {
|
if (IS_ERR(group)) {
|
||||||
free_uid(user);
|
free_uid(user);
|
||||||
return PTR_ERR(group);
|
return PTR_ERR(group);
|
||||||
|
|
|
@ -111,14 +111,12 @@ void fsnotify_put_group(struct fsnotify_group *group)
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(fsnotify_put_group);
|
EXPORT_SYMBOL_GPL(fsnotify_put_group);
|
||||||
|
|
||||||
/*
|
static struct fsnotify_group *__fsnotify_alloc_group(
|
||||||
* Create a new fsnotify_group and hold a reference for the group returned.
|
const struct fsnotify_ops *ops, gfp_t gfp)
|
||||||
*/
|
|
||||||
struct fsnotify_group *fsnotify_alloc_group(const struct fsnotify_ops *ops)
|
|
||||||
{
|
{
|
||||||
struct fsnotify_group *group;
|
struct fsnotify_group *group;
|
||||||
|
|
||||||
group = kzalloc(sizeof(struct fsnotify_group), GFP_KERNEL);
|
group = kzalloc(sizeof(struct fsnotify_group), gfp);
|
||||||
if (!group)
|
if (!group)
|
||||||
return ERR_PTR(-ENOMEM);
|
return ERR_PTR(-ENOMEM);
|
||||||
|
|
||||||
|
@ -139,8 +137,25 @@ struct fsnotify_group *fsnotify_alloc_group(const struct fsnotify_ops *ops)
|
||||||
|
|
||||||
return group;
|
return group;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Create a new fsnotify_group and hold a reference for the group returned.
|
||||||
|
*/
|
||||||
|
struct fsnotify_group *fsnotify_alloc_group(const struct fsnotify_ops *ops)
|
||||||
|
{
|
||||||
|
return __fsnotify_alloc_group(ops, GFP_KERNEL);
|
||||||
|
}
|
||||||
EXPORT_SYMBOL_GPL(fsnotify_alloc_group);
|
EXPORT_SYMBOL_GPL(fsnotify_alloc_group);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Create a new fsnotify_group and hold a reference for the group returned.
|
||||||
|
*/
|
||||||
|
struct fsnotify_group *fsnotify_alloc_user_group(const struct fsnotify_ops *ops)
|
||||||
|
{
|
||||||
|
return __fsnotify_alloc_group(ops, GFP_KERNEL_ACCOUNT);
|
||||||
|
}
|
||||||
|
EXPORT_SYMBOL_GPL(fsnotify_alloc_user_group);
|
||||||
|
|
||||||
int fsnotify_fasync(int fd, struct file *file, int on)
|
int fsnotify_fasync(int fd, struct file *file, int on)
|
||||||
{
|
{
|
||||||
struct fsnotify_group *group = file->private_data;
|
struct fsnotify_group *group = file->private_data;
|
||||||
|
|
|
@ -632,11 +632,11 @@ static struct fsnotify_group *inotify_new_group(unsigned int max_events)
|
||||||
struct fsnotify_group *group;
|
struct fsnotify_group *group;
|
||||||
struct inotify_event_info *oevent;
|
struct inotify_event_info *oevent;
|
||||||
|
|
||||||
group = fsnotify_alloc_group(&inotify_fsnotify_ops);
|
group = fsnotify_alloc_user_group(&inotify_fsnotify_ops);
|
||||||
if (IS_ERR(group))
|
if (IS_ERR(group))
|
||||||
return group;
|
return group;
|
||||||
|
|
||||||
oevent = kmalloc(sizeof(struct inotify_event_info), GFP_KERNEL);
|
oevent = kmalloc(sizeof(struct inotify_event_info), GFP_KERNEL_ACCOUNT);
|
||||||
if (unlikely(!oevent)) {
|
if (unlikely(!oevent)) {
|
||||||
fsnotify_destroy_group(group);
|
fsnotify_destroy_group(group);
|
||||||
return ERR_PTR(-ENOMEM);
|
return ERR_PTR(-ENOMEM);
|
||||||
|
|
|
@ -470,6 +470,7 @@ static inline void fsnotify_update_flags(struct dentry *dentry)
|
||||||
|
|
||||||
/* create a new group */
|
/* create a new group */
|
||||||
extern struct fsnotify_group *fsnotify_alloc_group(const struct fsnotify_ops *ops);
|
extern struct fsnotify_group *fsnotify_alloc_group(const struct fsnotify_ops *ops);
|
||||||
|
extern struct fsnotify_group *fsnotify_alloc_user_group(const struct fsnotify_ops *ops);
|
||||||
/* get reference to a group */
|
/* get reference to a group */
|
||||||
extern void fsnotify_get_group(struct fsnotify_group *group);
|
extern void fsnotify_get_group(struct fsnotify_group *group);
|
||||||
/* drop reference on a group from fsnotify_alloc_group */
|
/* drop reference on a group from fsnotify_alloc_group */
|
||||||
|
|
Loading…
Reference in New Issue