Re: [PATCH][RFC] checkpoint: refuse to checkpoint if monitoring directories with dnotify

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Reviewing my own patch...

On Wed, Feb 17, 2010 at 02:10:58PM -0800, Matt Helsley wrote:

<snip>

> diff --git a/fs/notify/dnotify/dnotify.c b/fs/notify/dnotify/dnotify.c
> index 7e54e52..9ce85f5 100644
> --- a/fs/notify/dnotify/dnotify.c
> +++ b/fs/notify/dnotify/dnotify.c
> @@ -289,6 +289,28 @@ static int attach_dn(struct dnotify_struct *dn, struct dnotify_mark_entry *dnent
>  	return 0;
>  }
> 
> +int is_dnotify_attached(struct file *filp)
> +{
> +	struct fsnotify_mark_entry *entry;
> +	struct dnotify_mark_entry *dnentry;
> +	struct dnotify_struct *dn;
> +	struct dnotify_struct **prev;

Ugh, most of these variables aren't needed.

> +	struct inode *inode;
> +
> +	inode = filp->f_path.dentry->d_inode;
> +	if (!S_ISDIR(inode->i_mode))
> +		return 0;
> +
> +	spin_lock(&inode->i_lock);
> +	entry = fsnotify_find_mark_entry(dnotify_group, inode);
> +	spin_unlock(&inode->i_lock);
> +	if (entry) {
> +		fsnotify_put_mark(new_entry);
> +		return 1;
> +	}

I flipped the test to look more like normal kernel code and fixed the
parameter to fsnotify_put_mark():

	if (!entry)
		return 0;
	fsnotify_put_mark(entry);
	return 1;

Cheers,
	-Matt Helsley
_______________________________________________
Containers mailing list
Containers@xxxxxxxxxxxxxxxxxxxxxxxxxx
https://lists.linux-foundation.org/mailman/listinfo/containers

[Index of Archives]     [Cgroups]     [Netdev]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux