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

Matt Helsley matthltc at us.ibm.com
Wed Feb 17 16:24:22 PST 2010


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 at lists.linux-foundation.org
https://lists.linux-foundation.org/mailman/listinfo/containers




More information about the Devel mailing list