Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs-2.6

* git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs-2.6:
jfs: Fix 32bit build warning
Remove obsolete comment in fs.h
Sanitize f_flags helpers
Fix f_flags/f_mode in case of lookup_instantiate_filp() from open(pathname, 3)
anonfd: Allow making anon files read-only
fs/compat_ioctl.c: fix build error when !BLOCK
pohmelfs needs I_LOCK
alloc_file(): simplify handling of mnt_clone_write() errors

+31 -34
-2
drivers/staging/pohmelfs/dir.c
··· 722 722 if (inode->i_nlink) 723 723 inode_dec_link_count(inode); 724 724 } 725 - dprintk("%s: inode: %p, lock: %ld, unhashed: %d.\n", 726 - __func__, pi, inode->i_state & I_LOCK, hlist_unhashed(&inode->i_hash)); 727 725 728 726 return err; 729 727 }
+2 -2
fs/anon_inodes.c
··· 121 121 d_instantiate(path.dentry, anon_inode_inode); 122 122 123 123 error = -ENFILE; 124 - file = alloc_file(&path, FMODE_READ | FMODE_WRITE, fops); 124 + file = alloc_file(&path, OPEN_FMODE(flags), fops); 125 125 if (!file) 126 126 goto err_dput; 127 127 file->f_mapping = anon_inode_inode->i_mapping; 128 128 129 129 file->f_pos = 0; 130 - file->f_flags = O_RDWR | (flags & O_NONBLOCK); 130 + file->f_flags = flags & (O_ACCMODE | O_NONBLOCK); 131 131 file->f_version = 0; 132 132 file->private_data = priv; 133 133
-2
fs/compat_ioctl.c
··· 1600 1600 case KDSKBMETA: 1601 1601 case KDSKBLED: 1602 1602 case KDSETLED: 1603 - /* SG stuff */ 1604 - case SG_SET_TRANSFORM: 1605 1603 /* AUTOFS */ 1606 1604 case AUTOFS_IOC_READY: 1607 1605 case AUTOFS_IOC_FAIL:
+1 -1
fs/eventfd.c
··· 339 339 ctx->flags = flags; 340 340 341 341 file = anon_inode_getfile("[eventfd]", &eventfd_fops, ctx, 342 - flags & EFD_SHARED_FCNTL_FLAGS); 342 + O_RDWR | (flags & EFD_SHARED_FCNTL_FLAGS)); 343 343 if (IS_ERR(file)) 344 344 eventfd_free_ctx(ctx); 345 345
+1 -1
fs/eventpoll.c
··· 1206 1206 * a file structure and a free file descriptor. 1207 1207 */ 1208 1208 error = anon_inode_getfd("[eventpoll]", &eventpoll_fops, ep, 1209 - flags & O_CLOEXEC); 1209 + O_RDWR | (flags & O_CLOEXEC)); 1210 1210 if (error < 0) 1211 1211 ep_free(ep); 1212 1212
+1 -3
fs/file_table.c
··· 186 186 * that we can do debugging checks at __fput() 187 187 */ 188 188 if ((mode & FMODE_WRITE) && !special_file(path->dentry->d_inode->i_mode)) { 189 - int error = 0; 190 189 file_take_write(file); 191 - error = mnt_clone_write(path->mnt); 192 - WARN_ON(error); 190 + WARN_ON(mnt_clone_write(path->mnt)); 193 191 } 194 192 ima_counts_get(file); 195 193 return file;
+7
fs/internal.h
··· 85 85 * super.c 86 86 */ 87 87 extern int do_remount_sb(struct super_block *, int, void *, int); 88 + 89 + /* 90 + * open.c 91 + */ 92 + struct nameidata; 93 + extern struct file *nameidata_to_filp(struct nameidata *); 94 + extern void release_open_intent(struct nameidata *);
+1 -1
fs/jfs/super.c
··· 524 524 * Page cache is indexed by long. 525 525 * I would use MAX_LFS_FILESIZE, but it's only half as big 526 526 */ 527 - sb->s_maxbytes = min(((u64) PAGE_CACHE_SIZE << 32) - 1, sb->s_maxbytes); 527 + sb->s_maxbytes = min(((u64) PAGE_CACHE_SIZE << 32) - 1, (u64)sb->s_maxbytes); 528 528 #endif 529 529 sb->s_time_gran = 1; 530 530 return 0;
+4 -4
fs/namei.c
··· 37 37 38 38 #include "internal.h" 39 39 40 - #define ACC_MODE(x) ("\000\004\002\006"[(x)&O_ACCMODE]) 41 - 42 40 /* [Feb-1997 T. Schoebel-Theuer] 43 41 * Fundamental changes in the pathname lookup mechanisms (namei) 44 42 * were necessary because of omirr. The reason is that omirr needs ··· 1638 1640 if (filp == NULL) 1639 1641 return ERR_PTR(-ENFILE); 1640 1642 nd.intent.open.file = filp; 1643 + filp->f_flags = open_flag; 1641 1644 nd.intent.open.flags = flag; 1642 1645 nd.intent.open.create_mode = 0; 1643 1646 error = do_path_lookup(dfd, pathname, ··· 1684 1685 if (filp == NULL) 1685 1686 goto exit_parent; 1686 1687 nd.intent.open.file = filp; 1688 + filp->f_flags = open_flag; 1687 1689 nd.intent.open.flags = flag; 1688 1690 nd.intent.open.create_mode = mode; 1689 1691 dir = nd.path.dentry; ··· 1725 1725 mnt_drop_write(nd.path.mnt); 1726 1726 goto exit; 1727 1727 } 1728 - filp = nameidata_to_filp(&nd, open_flag); 1728 + filp = nameidata_to_filp(&nd); 1729 1729 mnt_drop_write(nd.path.mnt); 1730 1730 if (nd.root.mnt) 1731 1731 path_put(&nd.root); ··· 1789 1789 mnt_drop_write(nd.path.mnt); 1790 1790 goto exit; 1791 1791 } 1792 - filp = nameidata_to_filp(&nd, open_flag); 1792 + filp = nameidata_to_filp(&nd); 1793 1793 if (!IS_ERR(filp)) { 1794 1794 error = ima_path_check(&filp->f_path, filp->f_mode & 1795 1795 (MAY_READ | MAY_WRITE | MAY_EXEC));
+6 -7
fs/open.c
··· 821 821 } 822 822 823 823 static struct file *__dentry_open(struct dentry *dentry, struct vfsmount *mnt, 824 - int flags, struct file *f, 824 + struct file *f, 825 825 int (*open)(struct inode *, struct file *), 826 826 const struct cred *cred) 827 827 { 828 828 struct inode *inode; 829 829 int error; 830 830 831 - f->f_flags = flags; 832 - f->f_mode = (__force fmode_t)((flags+1) & O_ACCMODE) | FMODE_LSEEK | 831 + f->f_mode = OPEN_FMODE(f->f_flags) | FMODE_LSEEK | 833 832 FMODE_PREAD | FMODE_PWRITE; 834 833 inode = dentry->d_inode; 835 834 if (f->f_mode & FMODE_WRITE) { ··· 929 930 if (IS_ERR(dentry)) 930 931 goto out_err; 931 932 nd->intent.open.file = __dentry_open(dget(dentry), mntget(nd->path.mnt), 932 - nd->intent.open.flags - 1, 933 933 nd->intent.open.file, 934 934 open, cred); 935 935 out: ··· 947 949 * 948 950 * Note that this function destroys the original nameidata 949 951 */ 950 - struct file *nameidata_to_filp(struct nameidata *nd, int flags) 952 + struct file *nameidata_to_filp(struct nameidata *nd) 951 953 { 952 954 const struct cred *cred = current_cred(); 953 955 struct file *filp; ··· 956 958 filp = nd->intent.open.file; 957 959 /* Has the filesystem initialised the file for us? */ 958 960 if (filp->f_path.dentry == NULL) 959 - filp = __dentry_open(nd->path.dentry, nd->path.mnt, flags, filp, 961 + filp = __dentry_open(nd->path.dentry, nd->path.mnt, filp, 960 962 NULL, cred); 961 963 else 962 964 path_put(&nd->path); ··· 995 997 return ERR_PTR(error); 996 998 } 997 999 998 - return __dentry_open(dentry, mnt, flags, f, NULL, cred); 1000 + f->f_flags = flags; 1001 + return __dentry_open(dentry, mnt, f, NULL, cred); 999 1002 } 1000 1003 EXPORT_SYMBOL(dentry_open); 1001 1004
+1 -1
fs/signalfd.c
··· 236 236 * anon_inode_getfd() will install the fd. 237 237 */ 238 238 ufd = anon_inode_getfd("[signalfd]", &signalfd_fops, ctx, 239 - flags & (O_CLOEXEC | O_NONBLOCK)); 239 + O_RDWR | (flags & (O_CLOEXEC | O_NONBLOCK))); 240 240 if (ufd < 0) 241 241 kfree(ctx); 242 242 } else {
+1 -1
fs/timerfd.c
··· 200 200 hrtimer_init(&ctx->tmr, clockid, HRTIMER_MODE_ABS); 201 201 202 202 ufd = anon_inode_getfd("[timerfd]", &timerfd_fops, ctx, 203 - flags & TFD_SHARED_FCNTL_FLAGS); 203 + O_RDWR | (flags & TFD_SHARED_FCNTL_FLAGS)); 204 204 if (ufd < 0) 205 205 kfree(ctx); 206 206
+3 -2
include/linux/fs.h
··· 1624 1624 * on the bit address once it is done. 1625 1625 * 1626 1626 * Q: What is the difference between I_WILL_FREE and I_FREEING? 1627 - * Q: igrab() only checks on (I_FREEING|I_WILL_FREE). Should it also check on 1628 - * I_CLEAR? If not, why? 1629 1627 */ 1630 1628 #define I_DIRTY_SYNC 1 1631 1629 #define I_DIRTY_DATASYNC 2 ··· 2461 2463 void __user *buffer, size_t *lenp, loff_t *ppos); 2462 2464 2463 2465 int __init get_filesystem_list(char *buf); 2466 + 2467 + #define ACC_MODE(x) ("\000\004\002\006"[(x)&O_ACCMODE]) 2468 + #define OPEN_FMODE(flag) ((__force fmode_t)((flag + 1) & O_ACCMODE)) 2464 2469 2465 2470 #endif /* __KERNEL__ */ 2466 2471 #endif /* _LINUX_FS_H */
-2
include/linux/namei.h
··· 72 72 73 73 extern struct file *lookup_instantiate_filp(struct nameidata *nd, struct dentry *dentry, 74 74 int (*open)(struct inode *, struct file *)); 75 - extern struct file *nameidata_to_filp(struct nameidata *nd, int flags); 76 - extern void release_open_intent(struct nameidata *); 77 75 78 76 extern struct dentry *lookup_one_len(const char *, struct dentry *, int); 79 77
-1
kernel/auditsc.c
··· 250 250 #endif 251 251 }; 252 252 253 - #define ACC_MODE(x) ("\004\002\006\006"[(x)&O_ACCMODE]) 254 253 static inline int open_arg(int flags, int mask) 255 254 { 256 255 int n = ACC_MODE(flags);
+1 -1
kernel/perf_event.c
··· 4724 4724 if (IS_ERR(event)) 4725 4725 goto err_put_context; 4726 4726 4727 - err = anon_inode_getfd("[perf_event]", &perf_fops, event, 0); 4727 + err = anon_inode_getfd("[perf_event]", &perf_fops, event, O_RDWR); 4728 4728 if (err < 0) 4729 4729 goto err_free_put_context; 4730 4730
-1
security/tomoyo/file.c
··· 12 12 #include "common.h" 13 13 #include "tomoyo.h" 14 14 #include "realpath.h" 15 - #define ACC_MODE(x) ("\000\004\002\006"[(x)&O_ACCMODE]) 16 15 17 16 /* 18 17 * tomoyo_globally_readable_file_entry is a structure which is used for holding
+2 -2
virt/kvm/kvm_main.c
··· 1177 1177 */ 1178 1178 static int create_vcpu_fd(struct kvm_vcpu *vcpu) 1179 1179 { 1180 - return anon_inode_getfd("kvm-vcpu", &kvm_vcpu_fops, vcpu, 0); 1180 + return anon_inode_getfd("kvm-vcpu", &kvm_vcpu_fops, vcpu, O_RDWR); 1181 1181 } 1182 1182 1183 1183 /* ··· 1638 1638 kvm = kvm_create_vm(); 1639 1639 if (IS_ERR(kvm)) 1640 1640 return PTR_ERR(kvm); 1641 - fd = anon_inode_getfd("kvm-vm", &kvm_vm_fops, kvm, 0); 1641 + fd = anon_inode_getfd("kvm-vm", &kvm_vm_fops, kvm, O_RDWR); 1642 1642 if (fd < 0) 1643 1643 kvm_put_kvm(kvm); 1644 1644