Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 127073 | Differences between
and this patch

Collapse All | Expand All

(-)unionfs-1.1.3/copyup.c (-4 / +4 lines)
Lines 64-70 static int copyup_xattrs(struct dentry * Link Here
64
	name_list_orig = name_list;
64
	name_list_orig = name_list;
65
	while (*name_list) {
65
	while (*name_list) {
66
		ssize_t size;
66
		ssize_t size;
67
		down(&old_hidden_dentry->d_inode->i_sem);
67
		mutex_lock(&old_hidden_dentry->d_inode->i_mutex);
68
		err = security_inode_getxattr(old_hidden_dentry, name_list);
68
		err = security_inode_getxattr(old_hidden_dentry, name_list);
69
		if (err)
69
		if (err)
70
			size = err;
70
			size = err;
Lines 73-79 static int copyup_xattrs(struct dentry * Link Here
73
			    old_hidden_dentry->d_inode->i_op->
73
			    old_hidden_dentry->d_inode->i_op->
74
			    getxattr(old_hidden_dentry, name_list, attr_value,
74
			    getxattr(old_hidden_dentry, name_list, attr_value,
75
				     XATTR_SIZE_MAX);
75
				     XATTR_SIZE_MAX);
76
		up(&old_hidden_dentry->d_inode->i_sem);
76
		mutex_unlock(&old_hidden_dentry->d_inode->i_mutex);
77
		if (size < 0) {
77
		if (size < 0) {
78
			err = size;
78
			err = size;
79
			goto out;
79
			goto out;
Lines 84-90 static int copyup_xattrs(struct dentry * Link Here
84
			goto out;
84
			goto out;
85
		}
85
		}
86
86
87
		down(&new_hidden_dentry->d_inode->i_sem);
87
		mutex_lock(&new_hidden_dentry->d_inode->i_mutex);
88
88
89
		err =
89
		err =
90
		    security_inode_setxattr(old_hidden_dentry, name_list,
90
		    security_inode_setxattr(old_hidden_dentry, name_list,
Lines 101-107 static int copyup_xattrs(struct dentry * Link Here
101
							     attr_value, size,
101
							     attr_value, size,
102
							     0);
102
							     0);
103
		}
103
		}
104
		up(&new_hidden_dentry->d_inode->i_sem);
104
		mutex_unlock(&new_hidden_dentry->d_inode->i_mutex);
105
105
106
		if (err < 0)
106
		if (err < 0)
107
			goto out;
107
			goto out;
(-)unionfs-1.1.3/dentry.c (-2 / +2 lines)
Lines 108-114 int unionfs_d_revalidate(struct dentry * Link Here
108
		interpose_flag = INTERPOSE_REVAL_NEG;
108
		interpose_flag = INTERPOSE_REVAL_NEG;
109
		if (positive) {
109
		if (positive) {
110
			interpose_flag = INTERPOSE_REVAL;
110
			interpose_flag = INTERPOSE_REVAL;
111
			down(&dentry->d_inode->i_sem);
111
			mutex_lock(&dentry->d_inode->i_mutex);
112
			bstart = ibstart(dentry->d_inode);
112
			bstart = ibstart(dentry->d_inode);
113
			bend = ibend(dentry->d_inode);
113
			bend = ibend(dentry->d_inode);
114
			if (bstart >= 0) {
114
			if (bstart >= 0) {
Lines 126-132 int unionfs_d_revalidate(struct dentry * Link Here
126
			itohi_ptr(dentry->d_inode) = NULL;
126
			itohi_ptr(dentry->d_inode) = NULL;
127
			ibstart(dentry->d_inode) = -1;
127
			ibstart(dentry->d_inode) = -1;
128
			ibend(dentry->d_inode) = -1;
128
			ibend(dentry->d_inode) = -1;
129
			up(&dentry->d_inode->i_sem);
129
			mutex_unlock(&dentry->d_inode->i_mutex);
130
		}
130
		}
131
131
132
		result = unionfs_lookup_backend(dentry, interpose_flag);
132
		result = unionfs_lookup_backend(dentry, interpose_flag);
(-)unionfs-1.1.3/dirhelper.c (-2 / +2 lines)
Lines 78-88 int delete_whiteouts(struct dentry *dent Link Here
78
				continue;
78
				continue;
79
			}
79
			}
80
80
81
			down(&hidden_dir_dentry->d_inode->i_sem);
81
			mutex_lock(&hidden_dir_dentry->d_inode->i_mutex);
82
			err =
82
			err =
83
			    vfs_unlink(hidden_dir_dentry->d_inode,
83
			    vfs_unlink(hidden_dir_dentry->d_inode,
84
				       hidden_dentry);
84
				       hidden_dentry);
85
			up(&hidden_dir_dentry->d_inode->i_sem);
85
			mutex_unlock(&hidden_dir_dentry->d_inode->i_mutex);
86
			DPUT(hidden_dentry);
86
			DPUT(hidden_dentry);
87
87
88
			if (err && !IS_COPYUP_ERR(err))
88
			if (err && !IS_COPYUP_ERR(err))
(-)unionfs-1.1.3/file.c (-2 / +2 lines)
Lines 264-273 static int unionfs_fsync(struct file *fi Link Here
264
	if (!hidden_file->f_op || !hidden_file->f_op->fsync)
264
	if (!hidden_file->f_op || !hidden_file->f_op->fsync)
265
		goto out;
265
		goto out;
266
266
267
	down(&hidden_file->f_dentry->d_inode->i_sem);
267
	mutex_lock(&hidden_file->f_dentry->d_inode->i_mutex);
268
	err = hidden_file->f_op->fsync(hidden_file, hidden_file->f_dentry,
268
	err = hidden_file->f_op->fsync(hidden_file, hidden_file->f_dentry,
269
				       datasync);
269
				       datasync);
270
	up(&hidden_file->f_dentry->d_inode->i_sem);
270
	mutex_unlock(&hidden_file->f_dentry->d_inode->i_mutex);
271
271
272
      out:
272
      out:
273
	print_exit_status(err);
273
	print_exit_status(err);
(-)unionfs-1.1.3/inode.c (-4 / +4 lines)
Lines 81-87 static int unionfs_create(struct inode * Link Here
81
		struct dentry *hidden_dir_dentry;
81
		struct dentry *hidden_dir_dentry;
82
		struct iattr newattrs;
82
		struct iattr newattrs;
83
83
84
		down(&whiteout_dentry->d_inode->i_sem);
84
		mutex_lock(&whiteout_dentry->d_inode->i_mutex);
85
		newattrs.ia_valid = ATTR_CTIME | ATTR_MODE | ATTR_ATIME
85
		newattrs.ia_valid = ATTR_CTIME | ATTR_MODE | ATTR_ATIME
86
		    | ATTR_MTIME | ATTR_UID | ATTR_GID | ATTR_FORCE
86
		    | ATTR_MTIME | ATTR_UID | ATTR_GID | ATTR_FORCE
87
		    | ATTR_KILL_SUID | ATTR_KILL_SGID;
87
		    | ATTR_KILL_SUID | ATTR_KILL_SGID;
Lines 97-103 static int unionfs_create(struct inode * Link Here
97
97
98
		err = notify_change(whiteout_dentry, &newattrs);
98
		err = notify_change(whiteout_dentry, &newattrs);
99
99
100
		up(&whiteout_dentry->d_inode->i_sem);
100
		mutex_unlock(&whiteout_dentry->d_inode->i_mutex);
101
101
102
		if (err)
102
		if (err)
103
			printk(KERN_WARNING
103
			printk(KERN_WARNING
Lines 594-603 static int unionfs_mkdir(struct inode *p Link Here
594
				err = PTR_ERR(whiteout_dentry);
594
				err = PTR_ERR(whiteout_dentry);
595
				goto out;
595
				goto out;
596
			}
596
			}
597
			down(&hidden_dentry->d_inode->i_sem);
597
			mutex_lock(&hidden_dentry->d_inode->i_mutex);
598
			err = vfs_create(hidden_dentry->d_inode,
598
			err = vfs_create(hidden_dentry->d_inode,
599
					 whiteout_dentry, 0600, NULL);
599
					 whiteout_dentry, 0600, NULL);
600
			up(&hidden_dentry->d_inode->i_sem);
600
			mutex_unlock(&hidden_dentry->d_inode->i_mutex);
601
			DPUT(whiteout_dentry);
601
			DPUT(whiteout_dentry);
602
602
603
			if (err) {
603
			if (err) {
(-)unionfs-1.1.3/main.c (-2 / +2 lines)
Lines 103-109 int unionfs_interpose(struct dentry *den Link Here
103
		}
103
		}
104
	}
104
	}
105
105
106
	down(&inode->i_sem);
106
	mutex_lock(&inode->i_mutex);
107
	if (atomic_read(&inode->i_count) > 1)
107
	if (atomic_read(&inode->i_count) > 1)
108
		goto skip;
108
		goto skip;
109
109
Lines 172-178 int unionfs_interpose(struct dentry *den Link Here
172
172
173
	fist_print_dentry("Leaving unionfs_interpose", dentry);
173
	fist_print_dentry("Leaving unionfs_interpose", dentry);
174
	fist_print_inode("Leaving unionfs_interpose", inode);
174
	fist_print_inode("Leaving unionfs_interpose", inode);
175
	up(&inode->i_sem);
175
	mutex_unlock(&inode->i_mutex);
176
176
177
      out:
177
      out:
178
	print_exit_status(err);
178
	print_exit_status(err);
(-)unionfs-1.1.3/unionfs.h (-2 / +2 lines)
Lines 776-788 static inline struct dentry *lock_parent Link Here
776
{
776
{
777
	struct dentry *dir = DGET(dentry->d_parent);
777
	struct dentry *dir = DGET(dentry->d_parent);
778
778
779
	down(&dir->d_inode->i_sem);
779
	mutex_lock(&dir->d_inode->i_mutex);
780
	return dir;
780
	return dir;
781
}
781
}
782
782
783
static inline void unlock_dir(struct dentry *dir)
783
static inline void unlock_dir(struct dentry *dir)
784
{
784
{
785
	up(&dir->d_inode->i_sem);
785
	mutex_unlock(&dir->d_inode->i_mutex);
786
	DPUT(dir);
786
	DPUT(dir);
787
}
787
}
788
788
(-)unionfs-1.1.3/xattr.c (-8 / +8 lines)
Lines 77-90 ssize_t unionfs_getxattr(struct dentry * Link Here
77
77
78
		encoded_value = (char *)value;
78
		encoded_value = (char *)value;
79
79
80
		down(&hidden_dentry->d_inode->i_sem);
80
		mutex_lock(&hidden_dentry->d_inode->i_mutex);
81
		/* lock_kernel() already done by caller. */
81
		/* lock_kernel() already done by caller. */
82
		err =
82
		err =
83
		    hidden_dentry->d_inode->i_op->getxattr(hidden_dentry,
83
		    hidden_dentry->d_inode->i_op->getxattr(hidden_dentry,
84
							   encoded_name,
84
							   encoded_name,
85
							   encoded_value, size);
85
							   encoded_value, size);
86
		/* unlock_kernel() will be done by caller. */
86
		/* unlock_kernel() will be done by caller. */
87
		up(&hidden_dentry->d_inode->i_sem);
87
		mutex_unlock(&hidden_dentry->d_inode->i_mutex);
88
88
89
	}
89
	}
90
90
Lines 112-123 unionfs_setxattr(struct dentry *dentry, Link Here
112
		    name, (unsigned long)size, flags);
112
		    name, (unsigned long)size, flags);
113
113
114
	if (hidden_dentry->d_inode->i_op->setxattr) {
114
	if (hidden_dentry->d_inode->i_op->setxattr) {
115
		down(&hidden_dentry->d_inode->i_sem);
115
		mutex_lock(&hidden_dentry->d_inode->i_mutex);
116
		/* lock_kernel() already done by caller. */
116
		/* lock_kernel() already done by caller. */
117
		err = hidden_dentry->d_inode->i_op->
117
		err = hidden_dentry->d_inode->i_op->
118
		    setxattr(hidden_dentry, name, value, size, flags);
118
		    setxattr(hidden_dentry, name, value, size, flags);
119
		/* unlock_kernel() will be done by caller. */
119
		/* unlock_kernel() will be done by caller. */
120
		up(&hidden_dentry->d_inode->i_sem);
120
		mutex_unlock(&hidden_dentry->d_inode->i_mutex);
121
	}
121
	}
122
122
123
	unlock_dentry(dentry);
123
	unlock_dentry(dentry);
Lines 143-155 int unionfs_removexattr(struct dentry *d Link Here
143
	if (hidden_dentry->d_inode->i_op->removexattr) {
143
	if (hidden_dentry->d_inode->i_op->removexattr) {
144
		encoded_name = (char *)name;
144
		encoded_name = (char *)name;
145
145
146
		down(&hidden_dentry->d_inode->i_sem);
146
		mutex_lock(&hidden_dentry->d_inode->i_mutex);
147
		/* lock_kernel() already done by caller. */
147
		/* lock_kernel() already done by caller. */
148
		err =
148
		err =
149
		    hidden_dentry->d_inode->i_op->removexattr(hidden_dentry,
149
		    hidden_dentry->d_inode->i_op->removexattr(hidden_dentry,
150
							      encoded_name);
150
							      encoded_name);
151
		/* unlock_kernel() will be done by caller. */
151
		/* unlock_kernel() will be done by caller. */
152
		up(&hidden_dentry->d_inode->i_sem);
152
		mutex_unlock(&hidden_dentry->d_inode->i_mutex);
153
	}
153
	}
154
154
155
	unlock_dentry(dentry);
155
	unlock_dentry(dentry);
Lines 173-185 ssize_t unionfs_listxattr(struct dentry Link Here
173
173
174
	if (hidden_dentry->d_inode->i_op->listxattr) {
174
	if (hidden_dentry->d_inode->i_op->listxattr) {
175
		encoded_list = list;
175
		encoded_list = list;
176
		down(&hidden_dentry->d_inode->i_sem);
176
		mutex_lock(&hidden_dentry->d_inode->i_mutex);
177
		/* lock_kernel() already done by caller. */
177
		/* lock_kernel() already done by caller. */
178
		err =
178
		err =
179
		    hidden_dentry->d_inode->i_op->listxattr(hidden_dentry,
179
		    hidden_dentry->d_inode->i_op->listxattr(hidden_dentry,
180
							    encoded_list, size);
180
							    encoded_list, size);
181
		/* unlock_kernel() will be done by caller. */
181
		/* unlock_kernel() will be done by caller. */
182
		up(&hidden_dentry->d_inode->i_sem);
182
		mutex_unlock(&hidden_dentry->d_inode->i_mutex);
183
	}
183
	}
184
184
185
	unlock_dentry(dentry);
185
	unlock_dentry(dentry);

Return to bug 127073