/* If multiple processes watch the same inode with dnotify there is only one dnotify mark in inode->i_fsnotify_mark_entries but we chain a dnotify_struct onto that mark. This function either attaches the new dnotify_struct onto that list, or it |= the mask onto an existing dnofiy_struct.  */
static int attach_dn(struct dnotify_struct *dn, struct dnotify_mark_entry *dnentry, fl_owner_t id, int fd, struct file *filp, __u32 mask)
/* If multiple processes watch the same inode with dnotify there is only one dnotify mark in inode->i_fsnotify_mark_entries but we chain a dnotify_struct onto that mark. This function either attaches the new dnotify_struct onto that list, or it |= the mask onto an existing dnofiy_struct.  */
static int attach_dn(struct dnotify_struct *dn, struct dnotify_mark_entry *dnentry, fl_owner_t id, int fd, struct file *filp, __u32 mask)
{
	struct dnotify_struct *odn;
	odn = dnentry->dn;
	while (odn != NULL) {
		if ((odn->dn_owner == id) && (odn->dn_filp == filp)) {
			odn->dn_fd = fd;
			odn->dn_mask |= mask;
			return -EEXIST;
		}
		odn = odn->dn_next;
	}
	dn->dn_mask = mask;
	dn->dn_fd = fd;
	dn->dn_filp = filp;
	dn->dn_owner = id;
	dn->dn_next = dnentry->dn;
	dnentry->dn = dn;
	return 0;
}