/[vps]/vserver-sources/2.0.1-r3/4914_vs2.0.1-bme-0.06.1.patch
Gentoo

Contents of /vserver-sources/2.0.1-r3/4914_vs2.0.1-bme-0.06.1.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 332 - (show annotations) (download)
Thu Apr 20 07:21:11 2006 UTC (8 years, 8 months ago) by phreak
File size: 30082 byte(s)
Fixing BME, just forgot a brace
1 Index: vserver-sources-2.6.15_2.0.1/arch/sparc64/solaris/fs.c
2 ===================================================================
3 --- vserver-sources-2.6.15_2.0.1.orig/arch/sparc64/solaris/fs.c
4 +++ vserver-sources-2.6.15_2.0.1/arch/sparc64/solaris/fs.c
5 @@ -362,7 +362,7 @@ static int report_statvfs(struct vfsmoun
6 int j = strlen (p);
7
8 if (j > 15) j = 15;
9 - if (IS_RDONLY(inode)) i = 1;
10 + if (IS_RDONLY(inode) || MNT_IS_RDONLY(mnt)) i = 1;
11 if (mnt->mnt_flags & MNT_NOSUID) i |= 2;
12 if (!sysv_valid_dev(inode->i_sb->s_dev))
13 return -EOVERFLOW;
14 @@ -398,7 +398,7 @@ static int report_statvfs64(struct vfsmo
15 int j = strlen (p);
16
17 if (j > 15) j = 15;
18 - if (IS_RDONLY(inode)) i = 1;
19 + if (IS_RDONLY(inode) || MNT_IS_RDONLY(mnt)) i = 1;
20 if (mnt->mnt_flags & MNT_NOSUID) i |= 2;
21 if (!sysv_valid_dev(inode->i_sb->s_dev))
22 return -EOVERFLOW;
23 Index: vserver-sources-2.6.15_2.0.1/fs/ext2/ioctl.c
24 ===================================================================
25 --- vserver-sources-2.6.15_2.0.1.orig/fs/ext2/ioctl.c
26 +++ vserver-sources-2.6.15_2.0.1/fs/ext2/ioctl.c
27 @@ -29,7 +29,8 @@ int ext2_ioctl (struct inode * inode, st
28 case EXT2_IOC_SETFLAGS: {
29 unsigned int oldflags;
30
31 - if (IS_RDONLY(inode))
32 + if (IS_RDONLY(inode) ||
33 + (filp && MNT_IS_RDONLY(filp->f_vfsmnt)))
34 return -EROFS;
35
36 if ((current->fsuid != inode->i_uid) && !capable(CAP_FOWNER))
37 @@ -70,7 +71,8 @@ int ext2_ioctl (struct inode * inode, st
38 case EXT2_IOC_SETVERSION:
39 if ((current->fsuid != inode->i_uid) && !capable(CAP_FOWNER))
40 return -EPERM;
41 - if (IS_RDONLY(inode))
42 + if (IS_RDONLY(inode) ||
43 + (filp && MNT_IS_RDONLY(filp->f_vfsmnt)))
44 return -EROFS;
45 if (get_user(inode->i_generation, (int __user *) arg))
46 return -EFAULT;
47 Index: vserver-sources-2.6.15_2.0.1/fs/ext3/ioctl.c
48 ===================================================================
49 --- vserver-sources-2.6.15_2.0.1.orig/fs/ext3/ioctl.c
50 +++ vserver-sources-2.6.15_2.0.1/fs/ext3/ioctl.c
51 @@ -36,7 +36,8 @@ int ext3_ioctl (struct inode * inode, st
52 unsigned int oldflags;
53 unsigned int jflag;
54
55 - if (IS_RDONLY(inode))
56 + if (IS_RDONLY(inode) ||
57 + (filp && MNT_IS_RDONLY(filp->f_vfsmnt)))
58 return -EROFS;
59
60 if ((current->fsuid != inode->i_uid) && !capable(CAP_FOWNER))
61 @@ -114,7 +115,8 @@ flags_err:
62
63 if ((current->fsuid != inode->i_uid) && !capable(CAP_FOWNER))
64 return -EPERM;
65 - if (IS_RDONLY(inode))
66 + if (IS_RDONLY(inode) ||
67 + (filp && MNT_IS_RDONLY(filp->f_vfsmnt)))
68 return -EROFS;
69 if (get_user(generation, (int __user *) arg))
70 return -EFAULT;
71 @@ -168,7 +170,8 @@ flags_err:
72 if (!test_opt(inode->i_sb, RESERVATION) ||!S_ISREG(inode->i_mode))
73 return -ENOTTY;
74
75 - if (IS_RDONLY(inode))
76 + if (IS_RDONLY(inode) ||
77 + (filp && MNT_IS_RDONLY(filp->f_vfsmnt)))
78 return -EROFS;
79
80 if ((current->fsuid != inode->i_uid) && !capable(CAP_FOWNER))
81 @@ -203,7 +206,8 @@ flags_err:
82 if (!capable(CAP_SYS_RESOURCE))
83 return -EPERM;
84
85 - if (IS_RDONLY(inode))
86 + if (IS_RDONLY(inode) ||
87 + (filp && MNT_IS_RDONLY(filp->f_vfsmnt)))
88 return -EROFS;
89
90 if (get_user(n_blocks_count, (__u32 __user *)arg))
91 @@ -224,7 +228,8 @@ flags_err:
92 if (!capable(CAP_SYS_RESOURCE))
93 return -EPERM;
94
95 - if (IS_RDONLY(inode))
96 + if (IS_RDONLY(inode) ||
97 + (filp && MNT_IS_RDONLY(filp->f_vfsmnt)))
98 return -EROFS;
99
100 if (copy_from_user(&input, (struct ext3_new_group_input __user *)arg,
101 Index: vserver-sources-2.6.15_2.0.1/fs/hfsplus/ioctl.c
102 ===================================================================
103 --- vserver-sources-2.6.15_2.0.1.orig/fs/hfsplus/ioctl.c
104 +++ vserver-sources-2.6.15_2.0.1/fs/hfsplus/ioctl.c
105 @@ -34,7 +34,8 @@ int hfsplus_ioctl(struct inode *inode, s
106 flags |= EXT2_FLAG_NODUMP; /* EXT2_NODUMP_FL */
107 return put_user(flags, (int __user *)arg);
108 case HFSPLUS_IOC_EXT2_SETFLAGS: {
109 - if (IS_RDONLY(inode))
110 + if (IS_RDONLY(inode) ||
111 + (filp && MNT_IS_RDONLY(filp->f_vfsmnt)))
112 return -EROFS;
113
114 if ((current->fsuid != inode->i_uid) && !capable(CAP_FOWNER))
115 Index: vserver-sources-2.6.15_2.0.1/fs/namei.c
116 ===================================================================
117 --- vserver-sources-2.6.15_2.0.1.orig/fs/namei.c
118 +++ vserver-sources-2.6.15_2.0.1/fs/namei.c
119 @@ -253,7 +253,7 @@ int permission(struct inode *inode, int
120 /*
121 * Nobody gets write access to a read-only fs.
122 */
123 - if (IS_RDONLY(inode) &&
124 + if ((IS_RDONLY(inode) || (nd && MNT_IS_RDONLY(nd->mnt))) &&
125 (S_ISREG(mode) || S_ISDIR(mode) || S_ISLNK(mode)))
126 return -EROFS;
127
128 @@ -1335,7 +1335,8 @@ static inline int check_sticky(struct in
129 * 10. We don't allow removal of NFS sillyrenamed files; it's handled by
130 * nfs_async_unlink().
131 */
132 -static inline int may_delete(struct inode *dir,struct dentry *victim,int isdir)
133 +static inline int may_delete(struct inode *dir, struct dentry *victim,
134 + int isdir, struct nameidata *nd)
135 {
136 int error;
137
138 @@ -1344,7 +1345,7 @@ static inline int may_delete(struct inod
139
140 BUG_ON(victim->d_parent->d_inode != dir);
141
142 - error = permission(dir,MAY_WRITE | MAY_EXEC, NULL);
143 + error = permission(dir,MAY_WRITE | MAY_EXEC, nd);
144 if (error)
145 return error;
146 if (IS_APPEND(dir))
147 @@ -1497,7 +1498,8 @@ int may_open(struct nameidata *nd, int a
148 return -EACCES;
149
150 flag &= ~O_TRUNC;
151 - } else if (IS_RDONLY(inode) && (flag & FMODE_WRITE))
152 + } else if ((IS_RDONLY(inode) || MNT_IS_RDONLY(nd->mnt))
153 + && (flag & FMODE_WRITE))
154 return -EROFS;
155 /*
156 * An append-only file must be opened in append mode for writing.
157 @@ -1761,9 +1763,10 @@ fail:
158 }
159 EXPORT_SYMBOL_GPL(lookup_create);
160
161 -int vfs_mknod(struct inode *dir, struct dentry *dentry, int mode, dev_t dev)
162 +int vfs_mknod(struct inode *dir, struct dentry *dentry,
163 + int mode, dev_t dev, struct nameidata *nd)
164 {
165 - int error = may_create(dir, dentry, NULL);
166 + int error = may_create(dir, dentry, nd);
167
168 if (error)
169 return error;
170 @@ -1803,7 +1806,6 @@ asmlinkage long sys_mknod(const char __u
171 goto out;
172 dentry = lookup_create(&nd, 0);
173 error = PTR_ERR(dentry);
174 -
175 if (!IS_POSIXACL(nd.dentry->d_inode))
176 mode &= ~current->fs->umask;
177 if (!IS_ERR(dentry)) {
178 @@ -1812,11 +1814,12 @@ asmlinkage long sys_mknod(const char __u
179 error = vfs_create(nd.dentry->d_inode,dentry,mode,&nd);
180 break;
181 case S_IFCHR: case S_IFBLK:
182 - error = vfs_mknod(nd.dentry->d_inode,dentry,mode,
183 - new_decode_dev(dev));
184 + error = vfs_mknod(nd.dentry->d_inode, dentry, mode,
185 + new_decode_dev(dev), &nd);
186 break;
187 case S_IFIFO: case S_IFSOCK:
188 - error = vfs_mknod(nd.dentry->d_inode,dentry,mode,0);
189 + error = vfs_mknod(nd.dentry->d_inode, dentry, mode,
190 + 0, &nd);
191 break;
192 case S_IFDIR:
193 error = -EPERM;
194 @@ -1834,9 +1837,10 @@ out:
195 return error;
196 }
197
198 -int vfs_mkdir(struct inode *dir, struct dentry *dentry, int mode)
199 +int vfs_mkdir(struct inode *dir, struct dentry *dentry,
200 + int mode, struct nameidata *nd)
201 {
202 - int error = may_create(dir, dentry, NULL);
203 + int error = may_create(dir, dentry, nd);
204
205 if (error)
206 return error;
207 @@ -1875,7 +1879,8 @@ asmlinkage long sys_mkdir(const char __u
208 if (!IS_ERR(dentry)) {
209 if (!IS_POSIXACL(nd.dentry->d_inode))
210 mode &= ~current->fs->umask;
211 - error = vfs_mkdir(nd.dentry->d_inode, dentry, mode);
212 + error = vfs_mkdir(nd.dentry->d_inode, dentry,
213 + mode, &nd);
214 dput(dentry);
215 }
216 up(&nd.dentry->d_inode->i_sem);
217 @@ -1915,9 +1920,10 @@ void dentry_unhash(struct dentry *dentry
218 spin_unlock(&dcache_lock);
219 }
220
221 -int vfs_rmdir(struct inode *dir, struct dentry *dentry)
222 +int vfs_rmdir(struct inode *dir, struct dentry *dentry,
223 + struct nameidata *nd)
224 {
225 - int error = may_delete(dir, dentry, 1);
226 + int error = may_delete(dir, dentry, 1, nd);
227
228 if (error)
229 return error;
230 @@ -1978,7 +1984,7 @@ asmlinkage long sys_rmdir(const char __u
231 dentry = lookup_hash(&nd);
232 error = PTR_ERR(dentry);
233 if (!IS_ERR(dentry)) {
234 - error = vfs_rmdir(nd.dentry->d_inode, dentry);
235 + error = vfs_rmdir(nd.dentry->d_inode, dentry, &nd);
236 dput(dentry);
237 }
238 up(&nd.dentry->d_inode->i_sem);
239 @@ -1989,9 +1995,10 @@ exit:
240 return error;
241 }
242
243 -int vfs_unlink(struct inode *dir, struct dentry *dentry)
244 +int vfs_unlink(struct inode *dir, struct dentry *dentry,
245 + struct nameidata *nd)
246 {
247 - int error = may_delete(dir, dentry, 0);
248 + int error = may_delete(dir, dentry, 0, nd);
249
250 if (error)
251 return error;
252 @@ -2053,7 +2060,7 @@ asmlinkage long sys_unlink(const char __
253 inode = dentry->d_inode;
254 if (inode)
255 atomic_inc(&inode->i_count);
256 - error = vfs_unlink(nd.dentry->d_inode, dentry);
257 + error = vfs_unlink(nd.dentry->d_inode, dentry, &nd);
258 exit2:
259 dput(dentry);
260 }
261 @@ -2072,9 +2079,10 @@ slashes:
262 goto exit2;
263 }
264
265 -int vfs_symlink(struct inode *dir, struct dentry *dentry, const char *oldname, int mode)
266 +int vfs_symlink(struct inode *dir, struct dentry *dentry,
267 + const char *oldname, int mode, struct nameidata *nd)
268 {
269 - int error = may_create(dir, dentry, NULL);
270 + int error = may_create(dir, dentry, nd);
271
272 if (error)
273 return error;
274 @@ -2114,7 +2122,8 @@ asmlinkage long sys_symlink(const char _
275 dentry = lookup_create(&nd, 0);
276 error = PTR_ERR(dentry);
277 if (!IS_ERR(dentry)) {
278 - error = vfs_symlink(nd.dentry->d_inode, dentry, from, S_IALLUGO);
279 + error = vfs_symlink(nd.dentry->d_inode, dentry,
280 + from, S_IALLUGO, &nd);
281 dput(dentry);
282 }
283 up(&nd.dentry->d_inode->i_sem);
284 @@ -2126,7 +2135,8 @@ out:
285 return error;
286 }
287
288 -int vfs_link(struct dentry *old_dentry, struct inode *dir, struct dentry *new_dentry)
289 +int vfs_link(struct dentry *old_dentry, struct inode *dir,
290 + struct dentry *new_dentry, struct nameidata *nd)
291 {
292 struct inode *inode = old_dentry->d_inode;
293 int error;
294 @@ -2134,7 +2144,7 @@ int vfs_link(struct dentry *old_dentry,
295 if (!inode)
296 return -ENOENT;
297
298 - error = may_create(dir, new_dentry, NULL);
299 + error = may_create(dir, new_dentry, nd);
300 if (error)
301 return error;
302
303 @@ -2196,7 +2206,8 @@ asmlinkage long sys_link(const char __us
304 new_dentry = lookup_create(&nd, 0);
305 error = PTR_ERR(new_dentry);
306 if (!IS_ERR(new_dentry)) {
307 - error = vfs_link(old_nd.dentry, nd.dentry->d_inode, new_dentry);
308 + error = vfs_link(old_nd.dentry, nd.dentry->d_inode,
309 + new_dentry, &nd);
310 dput(new_dentry);
311 }
312 up(&nd.dentry->d_inode->i_sem);
313 @@ -2323,14 +2334,14 @@ int vfs_rename(struct inode *old_dir, st
314 if (old_dentry->d_inode == new_dentry->d_inode)
315 return 0;
316
317 - error = may_delete(old_dir, old_dentry, is_dir);
318 + error = may_delete(old_dir, old_dentry, is_dir, NULL);
319 if (error)
320 return error;
321
322 if (!new_dentry->d_inode)
323 error = may_create(new_dir, new_dentry, NULL);
324 else
325 - error = may_delete(new_dir, new_dentry, is_dir);
326 + error = may_delete(new_dir, new_dentry, is_dir, NULL);
327 if (error)
328 return error;
329
330 @@ -2407,6 +2418,9 @@ static inline int do_rename(const char *
331 error = -EINVAL;
332 if (old_dentry == trap)
333 goto exit4;
334 + error = -EROFS;
335 + if (MNT_IS_RDONLY(newnd.mnt))
336 + goto exit4;
337 new_dentry = lookup_hash(&newnd);
338 error = PTR_ERR(new_dentry);
339 if (IS_ERR(new_dentry))
340 Index: vserver-sources-2.6.15_2.0.1/fs/namespace.c
341 ===================================================================
342 --- vserver-sources-2.6.15_2.0.1.orig/fs/namespace.c
343 +++ vserver-sources-2.6.15_2.0.1/fs/namespace.c
344 @@ -378,24 +378,26 @@ static int show_vfsmnt(struct seq_file *
345 struct vfsmount *mnt = v;
346 int err = 0;
347 static struct proc_fs_info {
348 - int flag;
349 - char *str;
350 + int s_flag;
351 + int mnt_flag;
352 + char *set_str;
353 + char *unset_str;
354 } fs_info[] = {
355 - { MS_SYNCHRONOUS, ",sync" },
356 - { MS_DIRSYNC, ",dirsync" },
357 - { MS_MANDLOCK, ",mand" },
358 - { MS_NOATIME, ",noatime" },
359 - { MS_NODIRATIME, ",nodiratime" },
360 - { MS_TAGXID, ",tagxid" },
361 - { 0, NULL }
362 + { MS_RDONLY, MNT_RDONLY, "ro", "rw" },
363 + { MS_SYNCHRONOUS, 0, ",sync", NULL },
364 + { MS_DIRSYNC, 0, ",dirsync", NULL },
365 + { MS_MANDLOCK, 0, ",mand", NULL },
366 + { MS_TAGXID, 0, ",tagxid", NULL },
367 + { MS_NOATIME, MNT_NOATIME, ",noatime", NULL },
368 + { MS_NODIRATIME, MNT_NODIRATIME, ",nodiratime", NULL },
369 + { 0, MNT_NOSUID, ",nosuid", NULL },
370 + { 0, MNT_NODEV, ",nodev", NULL },
371 + { 0, MNT_NOEXEC, ",noexec", NULL },
372 + { 0, 0, NULL, NULL }
373 };
374 - static struct proc_fs_info mnt_info[] = {
375 - { MNT_NOSUID, ",nosuid" },
376 - { MNT_NODEV, ",nodev" },
377 - { MNT_NOEXEC, ",noexec" },
378 - { 0, NULL }
379 - };
380 - struct proc_fs_info *fs_infop;
381 + struct proc_fs_info *p;
382 + unsigned long s_flags = mnt->mnt_sb->s_flags;
383 + int mnt_flags = mnt->mnt_flags;
384
385 if (vx_flags(VXF_HIDE_MOUNT, 0))
386 return 0;
387 @@ -412,14 +414,15 @@ static int show_vfsmnt(struct seq_file *
388 seq_putc(m, ' ');
389 }
390 mangle(m, mnt->mnt_sb->s_type->name);
391 - seq_puts(m, mnt->mnt_sb->s_flags & MS_RDONLY ? " ro" : " rw");
392 - for (fs_infop = fs_info; fs_infop->flag; fs_infop++) {
393 - if (mnt->mnt_sb->s_flags & fs_infop->flag)
394 - seq_puts(m, fs_infop->str);
395 - }
396 - for (fs_infop = mnt_info; fs_infop->flag; fs_infop++) {
397 - if (mnt->mnt_flags & fs_infop->flag)
398 - seq_puts(m, fs_infop->str);
399 + seq_putc(m, ' ');
400 + for (p = fs_info; (p->s_flag | p->mnt_flag) ; p++) {
401 + if ((s_flags & p->s_flag) || (mnt_flags & p->mnt_flag)) {
402 + if (p->set_str)
403 + seq_puts(m, p->set_str);
404 + } else {
405 + if (p->unset_str)
406 + seq_puts(m, p->unset_str);
407 + }
408 }
409 if (mnt->mnt_flags & MNT_XID)
410 seq_printf(m, ",xid=%d", mnt->mnt_xid);
411 @@ -923,7 +926,8 @@ static int do_change_type(struct nameida
412 /*
413 * do loopback mount.
414 */
415 -static int do_loopback(struct nameidata *nd, char *old_name, xid_t xid, int flags)
416 +static int do_loopback(struct nameidata *nd, char *old_name, xid_t xid,
417 + unsigned long flags, int mnt_flags)
418 {
419 struct nameidata old_nd;
420 struct vfsmount *mnt = NULL;
421 @@ -966,6 +970,7 @@ static int do_loopback(struct nameidata
422 spin_unlock(&vfsmount_lock);
423 release_mounts(&umount_list);
424 }
425 + mnt->mnt_flags = mnt_flags;
426
427 out:
428 up_write(&namespace_sem);
429 @@ -1361,12 +1366,18 @@ long do_mount(char *dev_name, char *dir_
430 }
431
432 /* Separate the per-mountpoint flags */
433 + if (flags & MS_RDONLY)
434 + mnt_flags |= MNT_RDONLY;
435 if (flags & MS_NOSUID)
436 mnt_flags |= MNT_NOSUID;
437 if (flags & MS_NODEV)
438 mnt_flags |= MNT_NODEV;
439 if (flags & MS_NOEXEC)
440 mnt_flags |= MNT_NOEXEC;
441 + if (flags & MS_NOATIME)
442 + mnt_flags |= MNT_NOATIME;
443 + if (flags & MS_NODIRATIME)
444 + mnt_flags |= MNT_NODIRATIME;
445 flags &= ~(MS_NOSUID | MS_NOEXEC | MS_NODEV | MS_ACTIVE);
446
447 if (vx_ccaps(VXC_SECURE_MOUNT))
448 @@ -1385,7 +1396,7 @@ long do_mount(char *dev_name, char *dir_
449 retval = do_remount(&nd, flags & ~MS_REMOUNT, mnt_flags,
450 data_page, xid);
451 else if (flags & MS_BIND)
452 - retval = do_loopback(&nd, dev_name, flags & MS_REC, xid);
453 + retval = do_loopback(&nd, dev_name, flags & MS_REC, xid, mnt_flags);
454 else if (flags & (MS_SHARED | MS_PRIVATE | MS_SLAVE | MS_UNBINDABLE))
455 retval = do_change_type(&nd, flags);
456 else if (flags & MS_MOVE)
457 Index: vserver-sources-2.6.15_2.0.1/fs/nfs/dir.c
458 ===================================================================
459 --- vserver-sources-2.6.15_2.0.1.orig/fs/nfs/dir.c
460 +++ vserver-sources-2.6.15_2.0.1/fs/nfs/dir.c
461 @@ -904,7 +904,8 @@ static int is_atomic_open(struct inode *
462 if (nd->flags & LOOKUP_DIRECTORY)
463 return 0;
464 /* Are we trying to write to a read only partition? */
465 - if (IS_RDONLY(dir) && (nd->intent.open.flags & (O_CREAT|O_TRUNC|FMODE_WRITE)))
466 + if ((IS_RDONLY(dir) || MNT_IS_RDONLY(nd->mnt)) &&
467 + (nd->intent.open.flags & (O_CREAT|O_TRUNC|FMODE_WRITE)))
468 return 0;
469 return 1;
470 }
471 Index: vserver-sources-2.6.15_2.0.1/fs/nfsd/vfs.c
472 ===================================================================
473 --- vserver-sources-2.6.15_2.0.1.orig/fs/nfsd/vfs.c
474 +++ vserver-sources-2.6.15_2.0.1/fs/nfsd/vfs.c
475 @@ -1161,13 +1161,13 @@ nfsd_create(struct svc_rqst *rqstp, stru
476 err = vfs_create(dirp, dchild, iap->ia_mode, NULL);
477 break;
478 case S_IFDIR:
479 - err = vfs_mkdir(dirp, dchild, iap->ia_mode);
480 + err = vfs_mkdir(dirp, dchild, iap->ia_mode, NULL);
481 break;
482 case S_IFCHR:
483 case S_IFBLK:
484 case S_IFIFO:
485 case S_IFSOCK:
486 - err = vfs_mknod(dirp, dchild, iap->ia_mode, rdev);
487 + err = vfs_mknod(dirp, dchild, iap->ia_mode, rdev, NULL);
488 break;
489 default:
490 printk("nfsd: bad file type %o in nfsd_create\n", type);
491 @@ -1443,11 +1443,13 @@ nfsd_symlink(struct svc_rqst *rqstp, str
492 else {
493 strncpy(path_alloced, path, plen);
494 path_alloced[plen] = 0;
495 - err = vfs_symlink(dentry->d_inode, dnew, path_alloced, mode);
496 + err = vfs_symlink(dentry->d_inode, dnew,
497 + path_alloced, mode, NULL);
498 kfree(path_alloced);
499 }
500 } else
501 - err = vfs_symlink(dentry->d_inode, dnew, path, mode);
502 + err = vfs_symlink(dentry->d_inode, dnew,
503 + path, mode, NULL);
504
505 if (!err) {
506 if (EX_ISSYNC(fhp->fh_export))
507 @@ -1505,7 +1507,7 @@ nfsd_link(struct svc_rqst *rqstp, struct
508 dold = tfhp->fh_dentry;
509 dest = dold->d_inode;
510
511 - err = vfs_link(dold, dirp, dnew);
512 + err = vfs_link(dold, dirp, dnew, NULL);
513 if (!err) {
514 if (EX_ISSYNC(ffhp->fh_export)) {
515 nfsd_sync_dir(ddir);
516 @@ -1666,9 +1668,9 @@ nfsd_unlink(struct svc_rqst *rqstp, stru
517 err = nfserr_perm;
518 } else
519 #endif
520 - err = vfs_unlink(dirp, rdentry);
521 + err = vfs_unlink(dirp, rdentry, NULL);
522 } else { /* It's RMDIR */
523 - err = vfs_rmdir(dirp, rdentry);
524 + err = vfs_rmdir(dirp, rdentry, NULL);
525 }
526
527 dput(rdentry);
528 @@ -1780,7 +1782,8 @@ nfsd_permission(struct svc_export *exp,
529 */
530 if (!(acc & MAY_LOCAL_ACCESS))
531 if (acc & (MAY_WRITE | MAY_SATTR | MAY_TRUNC)) {
532 - if (EX_RDONLY(exp) || IS_RDONLY(inode))
533 + if (EX_RDONLY(exp) || IS_RDONLY(inode)
534 + || MNT_IS_RDONLY(exp->ex_mnt))
535 return nfserr_rofs;
536 if (/* (acc & MAY_WRITE) && */ IS_IMMUTABLE(inode))
537 return nfserr_perm;
538 Index: vserver-sources-2.6.15_2.0.1/fs/open.c
539 ===================================================================
540 --- vserver-sources-2.6.15_2.0.1.orig/fs/open.c
541 +++ vserver-sources-2.6.15_2.0.1/fs/open.c
542 @@ -250,7 +250,7 @@ static inline long do_sys_truncate(const
543 goto dput_and_out;
544
545 error = -EROFS;
546 - if (IS_RDONLY(inode))
547 + if (IS_RDONLY(inode) || MNT_IS_RDONLY(nd.mnt))
548 goto dput_and_out;
549
550 error = -EPERM;
551 @@ -374,7 +374,7 @@ asmlinkage long sys_utime(char __user *
552 inode = nd.dentry->d_inode;
553
554 error = -EROFS;
555 - if (IS_RDONLY(inode))
556 + if (IS_RDONLY(inode) || MNT_IS_RDONLY(nd.mnt))
557 goto dput_and_out;
558
559 /* Don't worry, the checks are done in inode_change_ok() */
560 @@ -431,7 +431,7 @@ long do_utimes(char __user * filename, s
561 inode = nd.dentry->d_inode;
562
563 error = -EROFS;
564 - if (IS_RDONLY(inode))
565 + if (IS_RDONLY(inode) || MNT_IS_RDONLY(nd.mnt))
566 goto dput_and_out;
567
568 /* Don't worry, the checks are done in inode_change_ok() */
569 @@ -513,7 +513,8 @@ asmlinkage long sys_access(const char __
570 if (!res) {
571 res = vfs_permission(&nd, mode);
572 /* SuS v2 requires we report a read only fs too */
573 - if(!res && (mode & S_IWOTH) && IS_RDONLY(nd.dentry->d_inode)
574 + if(!res && (mode & S_IWOTH)
575 + && (IS_RDONLY(nd.dentry->d_inode) || MNT_IS_RDONLY(nd.mnt))
576 && !special_file(nd.dentry->d_inode->i_mode))
577 res = -EROFS;
578 path_release(&nd);
579 @@ -619,7 +620,7 @@ asmlinkage long sys_fchmod(unsigned int
580 inode = dentry->d_inode;
581
582 err = -EROFS;
583 - if (IS_RDONLY(inode))
584 + if (IS_RDONLY(inode) || MNT_IS_RDONLY(file->f_vfsmnt))
585 goto out_putf;
586 err = -EPERM;
587 if (IS_IMMUTABLE(inode) || IS_APPEND(inode))
588 @@ -651,7 +652,7 @@ asmlinkage long sys_chmod(const char __u
589 inode = nd.dentry->d_inode;
590
591 error = -EROFS;
592 - if (IS_RDONLY(inode))
593 + if (IS_RDONLY(inode) || MNT_IS_RDONLY(nd.mnt))
594 goto dput_and_out;
595
596 error = -EPERM;
597 @@ -672,7 +673,8 @@ out:
598 return error;
599 }
600
601 -static int chown_common(struct dentry * dentry, uid_t user, gid_t group)
602 +static int chown_common(struct dentry *dentry, struct vfsmount *mnt,
603 + uid_t user, gid_t group)
604 {
605 struct inode * inode;
606 int error;
607 @@ -684,7 +686,7 @@ static int chown_common(struct dentry *
608 goto out;
609 }
610 error = -EROFS;
611 - if (IS_RDONLY(inode))
612 + if (IS_RDONLY(inode) || MNT_IS_RDONLY(mnt))
613 goto out;
614 error = -EPERM;
615 if (IS_IMMUTABLE(inode) || IS_APPEND(inode))
616 @@ -714,7 +716,7 @@ asmlinkage long sys_chown(const char __u
617
618 error = user_path_walk(filename, &nd);
619 if (!error) {
620 - error = chown_common(nd.dentry, user, group);
621 + error = chown_common(nd.dentry, nd.mnt, user, group);
622 path_release(&nd);
623 }
624 return error;
625 @@ -727,7 +729,7 @@ asmlinkage long sys_lchown(const char __
626
627 error = user_path_walk_link(filename, &nd);
628 if (!error) {
629 - error = chown_common(nd.dentry, user, group);
630 + error = chown_common(nd.dentry, nd.mnt, user, group);
631 path_release(&nd);
632 }
633 return error;
634 @@ -741,7 +743,7 @@ asmlinkage long sys_fchown(unsigned int
635
636 file = fget(fd);
637 if (file) {
638 - error = chown_common(file->f_dentry, user, group);
639 + error = chown_common(file->f_dentry, file->f_vfsmnt, user, group);
640 fput(file);
641 }
642 return error;
643 Index: vserver-sources-2.6.15_2.0.1/fs/reiserfs/ioctl.c
644 ===================================================================
645 --- vserver-sources-2.6.15_2.0.1.orig/fs/reiserfs/ioctl.c
646 +++ vserver-sources-2.6.15_2.0.1/fs/reiserfs/ioctl.c
647 @@ -47,8 +47,8 @@ int reiserfs_ioctl(struct inode *inode,
648 if (!reiserfs_attrs(inode->i_sb))
649 return -ENOTTY;
650
651 - if (IS_RDONLY(inode))
652 - return -EROFS;
653 + if (IS_RDONLY(inode) ||
654 + (filp && MNT_IS_RDONLY(filp->f_vfsmnt)))
655
656 if ((current->fsuid != inode->i_uid)
657 && !capable(CAP_FOWNER))
658 @@ -87,7 +87,8 @@ int reiserfs_ioctl(struct inode *inode,
659 case REISERFS_IOC_SETVERSION:
660 if ((current->fsuid != inode->i_uid) && !capable(CAP_FOWNER))
661 return -EPERM;
662 - if (IS_RDONLY(inode))
663 + if (IS_RDONLY(inode) ||
664 + (filp && MNT_IS_RDONLY(filp->f_vfsmnt)))
665 return -EROFS;
666 if (get_user(inode->i_generation, (int __user *)arg))
667 return -EFAULT;
668 Index: vserver-sources-2.6.15_2.0.1/fs/reiserfs/xattr.c
669 ===================================================================
670 --- vserver-sources-2.6.15_2.0.1.orig/fs/reiserfs/xattr.c
671 +++ vserver-sources-2.6.15_2.0.1/fs/reiserfs/xattr.c
672 @@ -835,7 +835,7 @@ int reiserfs_delete_xattrs(struct inode
673 if (dir->d_inode->i_nlink <= 2) {
674 root = get_xa_root(inode->i_sb);
675 reiserfs_write_lock_xattrs(inode->i_sb);
676 - err = vfs_rmdir(root->d_inode, dir);
677 + err = vfs_rmdir(root->d_inode, dir, NULL);
678 reiserfs_write_unlock_xattrs(inode->i_sb);
679 dput(root);
680 } else {
681 @@ -1352,7 +1352,7 @@ __reiserfs_permission(struct inode *inod
682 /*
683 * Nobody gets write access to a read-only fs.
684 */
685 - if (IS_RDONLY(inode) &&
686 + if ((IS_RDONLY(inode) || (nd && MNT_IS_RDONLY(nd->mnt))) &&
687 (S_ISREG(mode) || S_ISDIR(mode) || S_ISLNK(mode)))
688 return -EROFS;
689
690 Index: vserver-sources-2.6.15_2.0.1/fs/xattr.c
691 ===================================================================
692 --- vserver-sources-2.6.15_2.0.1.orig/fs/xattr.c
693 +++ vserver-sources-2.6.15_2.0.1/fs/xattr.c
694 @@ -24,7 +24,7 @@
695 */
696 static long
697 setxattr(struct dentry *d, char __user *name, void __user *value,
698 - size_t size, int flags)
699 + size_t size, int flags, struct vfsmount *mnt)
700 {
701 int error;
702 void *kvalue = NULL;
703 @@ -55,6 +55,9 @@ setxattr(struct dentry *d, char __user *
704 error = security_inode_setxattr(d, kname, kvalue, size, flags);
705 if (error)
706 goto out;
707 + error = -EROFS;
708 + if (MNT_IS_RDONLY(mnt))
709 + goto out;
710 error = -EOPNOTSUPP;
711 if (d->d_inode->i_op && d->d_inode->i_op->setxattr) {
712 error = d->d_inode->i_op->setxattr(d, kname, kvalue,
713 @@ -88,7 +91,7 @@ sys_setxattr(char __user *path, char __u
714 error = user_path_walk(path, &nd);
715 if (error)
716 return error;
717 - error = setxattr(nd.dentry, name, value, size, flags);
718 + error = setxattr(nd.dentry, name, value, size, flags, nd.mnt);
719 path_release(&nd);
720 return error;
721 }
722 @@ -103,7 +106,7 @@ sys_lsetxattr(char __user *path, char __
723 error = user_path_walk_link(path, &nd);
724 if (error)
725 return error;
726 - error = setxattr(nd.dentry, name, value, size, flags);
727 + error = setxattr(nd.dentry, name, value, size, flags, nd.mnt);
728 path_release(&nd);
729 return error;
730 }
731 @@ -118,7 +121,7 @@ sys_fsetxattr(int fd, char __user *name,
732 f = fget(fd);
733 if (!f)
734 return error;
735 - error = setxattr(f->f_dentry, name, value, size, flags);
736 + error = setxattr(f->f_dentry, name, value, size, flags, f->f_vfsmnt);
737 fput(f);
738 return error;
739 }
740 @@ -307,7 +310,7 @@ sys_flistxattr(int fd, char __user *list
741 * Extended attribute REMOVE operations
742 */
743 static long
744 -removexattr(struct dentry *d, char __user *name)
745 +removexattr(struct dentry *d, char __user *name, struct vfsmount *mnt)
746 {
747 int error;
748 char kname[XATTR_NAME_MAX + 1];
749 @@ -323,6 +326,9 @@ removexattr(struct dentry *d, char __use
750 error = security_inode_removexattr(d, kname);
751 if (error)
752 goto out;
753 + error = -EROFS;
754 + if (MNT_IS_RDONLY(mnt))
755 + goto out;
756 down(&d->d_inode->i_sem);
757 error = d->d_inode->i_op->removexattr(d, kname);
758 up(&d->d_inode->i_sem);
759 @@ -342,7 +348,7 @@ sys_removexattr(char __user *path, char
760 error = user_path_walk(path, &nd);
761 if (error)
762 return error;
763 - error = removexattr(nd.dentry, name);
764 + error = removexattr(nd.dentry, name, nd.mnt);
765 path_release(&nd);
766 return error;
767 }
768 @@ -356,7 +362,7 @@ sys_lremovexattr(char __user *path, char
769 error = user_path_walk_link(path, &nd);
770 if (error)
771 return error;
772 - error = removexattr(nd.dentry, name);
773 + error = removexattr(nd.dentry, name, nd.mnt);
774 path_release(&nd);
775 return error;
776 }
777 @@ -370,7 +376,7 @@ sys_fremovexattr(int fd, char __user *na
778 f = fget(fd);
779 if (!f)
780 return error;
781 - error = removexattr(f->f_dentry, name);
782 + error = removexattr(f->f_dentry, name, f->f_vfsmnt);
783 fput(f);
784 return error;
785 }
786 Index: vserver-sources-2.6.15_2.0.1/include/linux/fs.h
787 ===================================================================
788 --- vserver-sources-2.6.15_2.0.1.orig/include/linux/fs.h
789 +++ vserver-sources-2.6.15_2.0.1/include/linux/fs.h
790 @@ -10,6 +10,7 @@
791 #include <linux/limits.h>
792 #include <linux/ioctl.h>
793 #include <linux/rcuref.h>
794 +#include <linux/mount.h>
795
796 /*
797 * It's silly to have NR_OPEN bigger than NR_FILE, but you can change
798 @@ -156,7 +157,7 @@ extern int dir_notify_enable;
799 */
800 #define __IS_FLG(inode,flg) ((inode)->i_sb->s_flags & (flg))
801
802 -#define IS_RDONLY(inode) ((inode)->i_sb->s_flags & MS_RDONLY)
803 +#define IS_RDONLY(inode) __IS_FLG(inode, MS_RDONLY)
804 #define IS_SYNC(inode) (__IS_FLG(inode, MS_SYNCHRONOUS) || \
805 ((inode)->i_flags & S_SYNC))
806 #define IS_DIRSYNC(inode) (__IS_FLG(inode, MS_SYNCHRONOUS|MS_DIRSYNC) || \
807 @@ -892,12 +893,12 @@ static inline void unlock_super(struct s
808 */
809 extern int vfs_permission(struct nameidata *, int);
810 extern int vfs_create(struct inode *, struct dentry *, int, struct nameidata *);
811 -extern int vfs_mkdir(struct inode *, struct dentry *, int);
812 -extern int vfs_mknod(struct inode *, struct dentry *, int, dev_t);
813 -extern int vfs_symlink(struct inode *, struct dentry *, const char *, int);
814 -extern int vfs_link(struct dentry *, struct inode *, struct dentry *);
815 -extern int vfs_rmdir(struct inode *, struct dentry *);
816 -extern int vfs_unlink(struct inode *, struct dentry *);
817 +extern int vfs_mkdir(struct inode *, struct dentry *, int, struct nameidata *);
818 +extern int vfs_mknod(struct inode *, struct dentry *, int, dev_t, struct nameidata *);
819 +extern int vfs_symlink(struct inode *, struct dentry *, const char *, int, struct nameidata *);
820 +extern int vfs_link(struct dentry *, struct inode *, struct dentry *, struct nameidata *);
821 +extern int vfs_rmdir(struct inode *, struct dentry *, struct nameidata *);
822 +extern int vfs_unlink(struct inode *, struct dentry *, struct nameidata *);
823 extern int vfs_rename(struct inode *, struct dentry *, struct inode *, struct dentry *);
824
825 /*
826 @@ -1104,8 +1105,16 @@ static inline void mark_inode_dirty_sync
827
828 static inline void touch_atime(struct vfsmount *mnt, struct dentry *dentry)
829 {
830 - /* per-mountpoint checks will go here */
831 - update_atime(dentry->d_inode);
832 + struct inode *inode = dentry->d_inode;
833 +
834 + if (MNT_IS_NOATIME(mnt))
835 + return;
836 + if (S_ISDIR(inode->i_mode) && MNT_IS_NODIRATIME(mnt))
837 + return;
838 + if (IS_RDONLY(inode) || MNT_IS_RDONLY(mnt))
839 + return;
840 +
841 + update_atime(inode);
842 }
843
844 static inline void file_accessed(struct file *file)
845 Index: vserver-sources-2.6.15_2.0.1/include/linux/mount.h
846 ===================================================================
847 --- vserver-sources-2.6.15_2.0.1.orig/include/linux/mount.h
848 +++ vserver-sources-2.6.15_2.0.1/include/linux/mount.h
849 @@ -23,6 +23,9 @@
850 #define MNT_SHARED 0x10 /* if the vfsmount is a shared mount */
851 #define MNT_UNBINDABLE 0x20 /* if the vfsmount is a unbindable mount */
852 #define MNT_PNODE_MASK 0x30 /* propogation flag mask */
853 +#define MNT_RDONLY 0x40
854 +#define MNT_NOATIME 0x50
855 +#define MNT_NODIRATIME 0x60
856 #define MNT_XID 0x100
857
858 struct vfsmount {
859 @@ -48,6 +51,10 @@ struct vfsmount {
860 xid_t mnt_xid; /* xid tagging used for vfsmount */
861 };
862
863 +#define MNT_IS_RDONLY(m) ((m) && ((m)->mnt_flags & MNT_RDONLY))
864 +#define MNT_IS_NOATIME(m) ((m) && ((m)->mnt_flags & MNT_NOATIME))
865 +#define MNT_IS_NODIRATIME(m) ((m) && ((m)->mnt_flags & MNT_NODIRATIME))
866 +
867 static inline struct vfsmount *mntget(struct vfsmount *mnt)
868 {
869 if (mnt)
870 Index: vserver-sources-2.6.15_2.0.1/ipc/mqueue.c
871 ===================================================================
872 --- vserver-sources-2.6.15_2.0.1.orig/ipc/mqueue.c
873 +++ vserver-sources-2.6.15_2.0.1/ipc/mqueue.c
874 @@ -746,7 +746,7 @@ asmlinkage long sys_mq_unlink(const char
875 if (inode)
876 atomic_inc(&inode->i_count);
877
878 - err = vfs_unlink(dentry->d_parent->d_inode, dentry);
879 + err = vfs_unlink(dentry->d_parent->d_inode, dentry, NULL);
880 out_err:
881 dput(dentry);
882
883 Index: vserver-sources-2.6.15_2.0.1/net/unix/af_unix.c
884 ===================================================================
885 --- vserver-sources-2.6.15_2.0.1.orig/net/unix/af_unix.c
886 +++ vserver-sources-2.6.15_2.0.1/net/unix/af_unix.c
887 @@ -784,7 +784,7 @@ static int unix_bind(struct socket *sock
888 */
889 mode = S_IFSOCK |
890 (SOCK_INODE(sock)->i_mode & ~current->fs->umask);
891 - err = vfs_mknod(nd.dentry->d_inode, dentry, mode, 0);
892 + err = vfs_mknod(nd.dentry->d_inode, dentry, mode, 0, NULL);
893 if (err)
894 goto out_mknod_dput;
895 up(&nd.dentry->d_inode->i_sem);

  ViewVC Help
Powered by ViewVC 1.1.20