diff options
Diffstat (limited to 'fs')
-rw-r--r-- | fs/9p/v9fs_vfs.h | 6 | ||||
-rw-r--r-- | fs/9p/vfs_file.c | 36 | ||||
-rw-r--r-- | fs/9p/vfs_inode.c | 139 | ||||
-rw-r--r-- | fs/9p/vfs_inode_dotl.c | 86 | ||||
-rw-r--r-- | fs/9p/vfs_super.c | 2 | ||||
-rw-r--r-- | fs/block_dev.c | 7 | ||||
-rw-r--r-- | fs/btrfs/btrfs_inode.h | 6 | ||||
-rw-r--r-- | fs/btrfs/file-item.c | 4 | ||||
-rw-r--r-- | fs/btrfs/file.c | 49 | ||||
-rw-r--r-- | fs/btrfs/free-space-cache.c | 4 | ||||
-rw-r--r-- | fs/btrfs/inode.c | 40 | ||||
-rw-r--r-- | fs/btrfs/ioctl.c | 40 | ||||
-rw-r--r-- | fs/btrfs/transaction.c | 4 | ||||
-rw-r--r-- | fs/btrfs/xattr.c | 9 | ||||
-rw-r--r-- | fs/ceph/mds_client.c | 2 | ||||
-rw-r--r-- | fs/ceph/super.c | 4 | ||||
-rw-r--r-- | fs/cifs/cifsencrypt.c | 54 | ||||
-rw-r--r-- | fs/cifs/cifsfs.c | 10 | ||||
-rw-r--r-- | fs/cifs/cifssmb.c | 3 | ||||
-rw-r--r-- | fs/cifs/connect.c | 4 | ||||
-rw-r--r-- | fs/compat.c | 5 | ||||
-rw-r--r-- | fs/ext3/inode.c | 4 | ||||
-rw-r--r-- | fs/ext3/namei.c | 3 | ||||
-rw-r--r-- | fs/ext4/ext4.h | 1 | ||||
-rw-r--r-- | fs/ext4/inode.c | 7 | ||||
-rw-r--r-- | fs/ext4/namei.c | 3 | ||||
-rw-r--r-- | fs/ext4/page-io.c | 18 | ||||
-rw-r--r-- | fs/fuse/dev.c | 16 | ||||
-rw-r--r-- | fs/fuse/file.c | 84 | ||||
-rw-r--r-- | fs/fuse/fuse_i.h | 8 | ||||
-rw-r--r-- | fs/fuse/inode.c | 13 | ||||
-rw-r--r-- | fs/gfs2/log.c | 4 | ||||
-rw-r--r-- | fs/gfs2/meta_io.c | 6 | ||||
-rw-r--r-- | fs/gfs2/ops_fstype.c | 2 | ||||
-rw-r--r-- | fs/gfs2/quota.c | 2 | ||||
-rw-r--r-- | fs/hfsplus/super.c | 15 | ||||
-rw-r--r-- | fs/hfsplus/wrapper.c | 4 | ||||
-rw-r--r-- | fs/hugetlbfs/inode.c | 1 | ||||
-rw-r--r-- | fs/inode.c | 24 | ||||
-rw-r--r-- | fs/namei.c | 41 | ||||
-rw-r--r-- | fs/namespace.c | 2 | ||||
-rw-r--r-- | fs/nfs/nfs4_fs.h | 8 | ||||
-rw-r--r-- | fs/nfs/nfs4proc.c | 20 | ||||
-rw-r--r-- | fs/nfs/nfs4renewd.c | 12 | ||||
-rw-r--r-- | fs/nfs/nfs4state.c | 6 | ||||
-rw-r--r-- | fs/nfs/super.c | 25 | ||||
-rw-r--r-- | fs/nfs/write.c | 2 | ||||
-rw-r--r-- | fs/proc/task_mmu.c | 80 | ||||
-rw-r--r-- | fs/quota/quota.c | 2 | ||||
-rw-r--r-- | fs/stat.c | 2 | ||||
-rw-r--r-- | fs/ubifs/debug.h | 6 | ||||
-rw-r--r-- | fs/xfs/Makefile | 119 | ||||
-rw-r--r-- | fs/xfs/kmem.c (renamed from fs/xfs/linux-2.6/kmem.c) | 0 | ||||
-rw-r--r-- | fs/xfs/kmem.h (renamed from fs/xfs/linux-2.6/kmem.h) | 0 | ||||
-rw-r--r-- | fs/xfs/mrlock.h (renamed from fs/xfs/linux-2.6/mrlock.h) | 0 | ||||
-rw-r--r-- | fs/xfs/time.h (renamed from fs/xfs/linux-2.6/time.h) | 0 | ||||
-rw-r--r-- | fs/xfs/uuid.c (renamed from fs/xfs/support/uuid.c) | 0 | ||||
-rw-r--r-- | fs/xfs/uuid.h (renamed from fs/xfs/support/uuid.h) | 0 | ||||
-rw-r--r-- | fs/xfs/xfs.h | 3 | ||||
-rw-r--r-- | fs/xfs/xfs_acl.c (renamed from fs/xfs/linux-2.6/xfs_acl.c) | 0 | ||||
-rw-r--r-- | fs/xfs/xfs_aops.c (renamed from fs/xfs/linux-2.6/xfs_aops.c) | 3 | ||||
-rw-r--r-- | fs/xfs/xfs_aops.h (renamed from fs/xfs/linux-2.6/xfs_aops.h) | 0 | ||||
-rw-r--r-- | fs/xfs/xfs_buf.c (renamed from fs/xfs/linux-2.6/xfs_buf.c) | 0 | ||||
-rw-r--r-- | fs/xfs/xfs_buf.h (renamed from fs/xfs/linux-2.6/xfs_buf.h) | 0 | ||||
-rw-r--r-- | fs/xfs/xfs_discard.c (renamed from fs/xfs/linux-2.6/xfs_discard.c) | 0 | ||||
-rw-r--r-- | fs/xfs/xfs_discard.h (renamed from fs/xfs/linux-2.6/xfs_discard.h) | 0 | ||||
-rw-r--r-- | fs/xfs/xfs_dquot.c (renamed from fs/xfs/quota/xfs_dquot.c) | 0 | ||||
-rw-r--r-- | fs/xfs/xfs_dquot.h (renamed from fs/xfs/quota/xfs_dquot.h) | 0 | ||||
-rw-r--r-- | fs/xfs/xfs_dquot_item.c (renamed from fs/xfs/quota/xfs_dquot_item.c) | 0 | ||||
-rw-r--r-- | fs/xfs/xfs_dquot_item.h (renamed from fs/xfs/quota/xfs_dquot_item.h) | 0 | ||||
-rw-r--r-- | fs/xfs/xfs_export.c (renamed from fs/xfs/linux-2.6/xfs_export.c) | 0 | ||||
-rw-r--r-- | fs/xfs/xfs_export.h (renamed from fs/xfs/linux-2.6/xfs_export.h) | 0 | ||||
-rw-r--r-- | fs/xfs/xfs_file.c (renamed from fs/xfs/linux-2.6/xfs_file.c) | 0 | ||||
-rw-r--r-- | fs/xfs/xfs_fs_subr.c (renamed from fs/xfs/linux-2.6/xfs_fs_subr.c) | 0 | ||||
-rw-r--r-- | fs/xfs/xfs_globals.c (renamed from fs/xfs/linux-2.6/xfs_globals.c) | 0 | ||||
-rw-r--r-- | fs/xfs/xfs_ioctl.c (renamed from fs/xfs/linux-2.6/xfs_ioctl.c) | 0 | ||||
-rw-r--r-- | fs/xfs/xfs_ioctl.h (renamed from fs/xfs/linux-2.6/xfs_ioctl.h) | 0 | ||||
-rw-r--r-- | fs/xfs/xfs_ioctl32.c (renamed from fs/xfs/linux-2.6/xfs_ioctl32.c) | 0 | ||||
-rw-r--r-- | fs/xfs/xfs_ioctl32.h (renamed from fs/xfs/linux-2.6/xfs_ioctl32.h) | 0 | ||||
-rw-r--r-- | fs/xfs/xfs_iops.c (renamed from fs/xfs/linux-2.6/xfs_iops.c) | 14 | ||||
-rw-r--r-- | fs/xfs/xfs_iops.h (renamed from fs/xfs/linux-2.6/xfs_iops.h) | 0 | ||||
-rw-r--r-- | fs/xfs/xfs_linux.h (renamed from fs/xfs/linux-2.6/xfs_linux.h) | 27 | ||||
-rw-r--r-- | fs/xfs/xfs_message.c (renamed from fs/xfs/linux-2.6/xfs_message.c) | 0 | ||||
-rw-r--r-- | fs/xfs/xfs_message.h (renamed from fs/xfs/linux-2.6/xfs_message.h) | 0 | ||||
-rw-r--r-- | fs/xfs/xfs_qm.c (renamed from fs/xfs/quota/xfs_qm.c) | 0 | ||||
-rw-r--r-- | fs/xfs/xfs_qm.h (renamed from fs/xfs/quota/xfs_qm.h) | 0 | ||||
-rw-r--r-- | fs/xfs/xfs_qm_bhv.c (renamed from fs/xfs/quota/xfs_qm_bhv.c) | 0 | ||||
-rw-r--r-- | fs/xfs/xfs_qm_stats.c (renamed from fs/xfs/quota/xfs_qm_stats.c) | 0 | ||||
-rw-r--r-- | fs/xfs/xfs_qm_stats.h (renamed from fs/xfs/quota/xfs_qm_stats.h) | 0 | ||||
-rw-r--r-- | fs/xfs/xfs_qm_syscalls.c (renamed from fs/xfs/quota/xfs_qm_syscalls.c) | 0 | ||||
-rw-r--r-- | fs/xfs/xfs_quota_priv.h (renamed from fs/xfs/quota/xfs_quota_priv.h) | 0 | ||||
-rw-r--r-- | fs/xfs/xfs_quotaops.c (renamed from fs/xfs/linux-2.6/xfs_quotaops.c) | 2 | ||||
-rw-r--r-- | fs/xfs/xfs_stats.c (renamed from fs/xfs/linux-2.6/xfs_stats.c) | 0 | ||||
-rw-r--r-- | fs/xfs/xfs_stats.h (renamed from fs/xfs/linux-2.6/xfs_stats.h) | 0 | ||||
-rw-r--r-- | fs/xfs/xfs_super.c (renamed from fs/xfs/linux-2.6/xfs_super.c) | 36 | ||||
-rw-r--r-- | fs/xfs/xfs_super.h (renamed from fs/xfs/linux-2.6/xfs_super.h) | 0 | ||||
-rw-r--r-- | fs/xfs/xfs_sync.c (renamed from fs/xfs/linux-2.6/xfs_sync.c) | 0 | ||||
-rw-r--r-- | fs/xfs/xfs_sync.h (renamed from fs/xfs/linux-2.6/xfs_sync.h) | 0 | ||||
-rw-r--r-- | fs/xfs/xfs_sysctl.c (renamed from fs/xfs/linux-2.6/xfs_sysctl.c) | 0 | ||||
-rw-r--r-- | fs/xfs/xfs_sysctl.h (renamed from fs/xfs/linux-2.6/xfs_sysctl.h) | 0 | ||||
-rw-r--r-- | fs/xfs/xfs_trace.c (renamed from fs/xfs/linux-2.6/xfs_trace.c) | 4 | ||||
-rw-r--r-- | fs/xfs/xfs_trace.h (renamed from fs/xfs/linux-2.6/xfs_trace.h) | 0 | ||||
-rw-r--r-- | fs/xfs/xfs_trans_dquot.c (renamed from fs/xfs/quota/xfs_trans_dquot.c) | 0 | ||||
-rw-r--r-- | fs/xfs/xfs_vnode.h (renamed from fs/xfs/linux-2.6/xfs_vnode.h) | 0 | ||||
-rw-r--r-- | fs/xfs/xfs_xattr.c (renamed from fs/xfs/linux-2.6/xfs_xattr.c) | 0 |
105 files changed, 674 insertions, 469 deletions
diff --git a/fs/9p/v9fs_vfs.h b/fs/9p/v9fs_vfs.h index 46ce357ca1ab..410ffd6ceb5f 100644 --- a/fs/9p/v9fs_vfs.h +++ b/fs/9p/v9fs_vfs.h | |||
@@ -54,9 +54,9 @@ extern struct kmem_cache *v9fs_inode_cache; | |||
54 | 54 | ||
55 | struct inode *v9fs_alloc_inode(struct super_block *sb); | 55 | struct inode *v9fs_alloc_inode(struct super_block *sb); |
56 | void v9fs_destroy_inode(struct inode *inode); | 56 | void v9fs_destroy_inode(struct inode *inode); |
57 | struct inode *v9fs_get_inode(struct super_block *sb, int mode); | 57 | struct inode *v9fs_get_inode(struct super_block *sb, int mode, dev_t); |
58 | int v9fs_init_inode(struct v9fs_session_info *v9ses, | 58 | int v9fs_init_inode(struct v9fs_session_info *v9ses, |
59 | struct inode *inode, int mode); | 59 | struct inode *inode, int mode, dev_t); |
60 | void v9fs_evict_inode(struct inode *inode); | 60 | void v9fs_evict_inode(struct inode *inode); |
61 | ino_t v9fs_qid2ino(struct p9_qid *qid); | 61 | ino_t v9fs_qid2ino(struct p9_qid *qid); |
62 | void v9fs_stat2inode(struct p9_wstat *, struct inode *, struct super_block *); | 62 | void v9fs_stat2inode(struct p9_wstat *, struct inode *, struct super_block *); |
@@ -83,4 +83,6 @@ static inline void v9fs_invalidate_inode_attr(struct inode *inode) | |||
83 | v9inode->cache_validity |= V9FS_INO_INVALID_ATTR; | 83 | v9inode->cache_validity |= V9FS_INO_INVALID_ATTR; |
84 | return; | 84 | return; |
85 | } | 85 | } |
86 | |||
87 | int v9fs_open_to_dotl_flags(int flags); | ||
86 | #endif | 88 | #endif |
diff --git a/fs/9p/vfs_file.c b/fs/9p/vfs_file.c index 3c173fcc2c5a..62857a810a79 100644 --- a/fs/9p/vfs_file.c +++ b/fs/9p/vfs_file.c | |||
@@ -65,7 +65,7 @@ int v9fs_file_open(struct inode *inode, struct file *file) | |||
65 | v9inode = V9FS_I(inode); | 65 | v9inode = V9FS_I(inode); |
66 | v9ses = v9fs_inode2v9ses(inode); | 66 | v9ses = v9fs_inode2v9ses(inode); |
67 | if (v9fs_proto_dotl(v9ses)) | 67 | if (v9fs_proto_dotl(v9ses)) |
68 | omode = file->f_flags; | 68 | omode = v9fs_open_to_dotl_flags(file->f_flags); |
69 | else | 69 | else |
70 | omode = v9fs_uflags2omode(file->f_flags, | 70 | omode = v9fs_uflags2omode(file->f_flags, |
71 | v9fs_proto_dotu(v9ses)); | 71 | v9fs_proto_dotu(v9ses)); |
@@ -169,7 +169,18 @@ static int v9fs_file_do_lock(struct file *filp, int cmd, struct file_lock *fl) | |||
169 | 169 | ||
170 | /* convert posix lock to p9 tlock args */ | 170 | /* convert posix lock to p9 tlock args */ |
171 | memset(&flock, 0, sizeof(flock)); | 171 | memset(&flock, 0, sizeof(flock)); |
172 | flock.type = fl->fl_type; | 172 | /* map the lock type */ |
173 | switch (fl->fl_type) { | ||
174 | case F_RDLCK: | ||
175 | flock.type = P9_LOCK_TYPE_RDLCK; | ||
176 | break; | ||
177 | case F_WRLCK: | ||
178 | flock.type = P9_LOCK_TYPE_WRLCK; | ||
179 | break; | ||
180 | case F_UNLCK: | ||
181 | flock.type = P9_LOCK_TYPE_UNLCK; | ||
182 | break; | ||
183 | } | ||
173 | flock.start = fl->fl_start; | 184 | flock.start = fl->fl_start; |
174 | if (fl->fl_end == OFFSET_MAX) | 185 | if (fl->fl_end == OFFSET_MAX) |
175 | flock.length = 0; | 186 | flock.length = 0; |
@@ -245,7 +256,7 @@ static int v9fs_file_getlock(struct file *filp, struct file_lock *fl) | |||
245 | 256 | ||
246 | /* convert posix lock to p9 tgetlock args */ | 257 | /* convert posix lock to p9 tgetlock args */ |
247 | memset(&glock, 0, sizeof(glock)); | 258 | memset(&glock, 0, sizeof(glock)); |
248 | glock.type = fl->fl_type; | 259 | glock.type = P9_LOCK_TYPE_UNLCK; |
249 | glock.start = fl->fl_start; | 260 | glock.start = fl->fl_start; |
250 | if (fl->fl_end == OFFSET_MAX) | 261 | if (fl->fl_end == OFFSET_MAX) |
251 | glock.length = 0; | 262 | glock.length = 0; |
@@ -257,17 +268,26 @@ static int v9fs_file_getlock(struct file *filp, struct file_lock *fl) | |||
257 | res = p9_client_getlock_dotl(fid, &glock); | 268 | res = p9_client_getlock_dotl(fid, &glock); |
258 | if (res < 0) | 269 | if (res < 0) |
259 | return res; | 270 | return res; |
260 | if (glock.type != F_UNLCK) { | 271 | /* map 9p lock type to os lock type */ |
261 | fl->fl_type = glock.type; | 272 | switch (glock.type) { |
273 | case P9_LOCK_TYPE_RDLCK: | ||
274 | fl->fl_type = F_RDLCK; | ||
275 | break; | ||
276 | case P9_LOCK_TYPE_WRLCK: | ||
277 | fl->fl_type = F_WRLCK; | ||
278 | break; | ||
279 | case P9_LOCK_TYPE_UNLCK: | ||
280 | fl->fl_type = F_UNLCK; | ||
281 | break; | ||
282 | } | ||
283 | if (glock.type != P9_LOCK_TYPE_UNLCK) { | ||
262 | fl->fl_start = glock.start; | 284 | fl->fl_start = glock.start; |
263 | if (glock.length == 0) | 285 | if (glock.length == 0) |
264 | fl->fl_end = OFFSET_MAX; | 286 | fl->fl_end = OFFSET_MAX; |
265 | else | 287 | else |
266 | fl->fl_end = glock.start + glock.length - 1; | 288 | fl->fl_end = glock.start + glock.length - 1; |
267 | fl->fl_pid = glock.proc_id; | 289 | fl->fl_pid = glock.proc_id; |
268 | } else | 290 | } |
269 | fl->fl_type = F_UNLCK; | ||
270 | |||
271 | return res; | 291 | return res; |
272 | } | 292 | } |
273 | 293 | ||
diff --git a/fs/9p/vfs_inode.c b/fs/9p/vfs_inode.c index 8bb5507e822f..e3c03db3c788 100644 --- a/fs/9p/vfs_inode.c +++ b/fs/9p/vfs_inode.c | |||
@@ -95,15 +95,18 @@ static int unixmode2p9mode(struct v9fs_session_info *v9ses, int mode) | |||
95 | /** | 95 | /** |
96 | * p9mode2unixmode- convert plan9 mode bits to unix mode bits | 96 | * p9mode2unixmode- convert plan9 mode bits to unix mode bits |
97 | * @v9ses: v9fs session information | 97 | * @v9ses: v9fs session information |
98 | * @mode: mode to convert | 98 | * @stat: p9_wstat from which mode need to be derived |
99 | * @rdev: major number, minor number in case of device files. | ||
99 | * | 100 | * |
100 | */ | 101 | */ |
101 | 102 | static int p9mode2unixmode(struct v9fs_session_info *v9ses, | |
102 | static int p9mode2unixmode(struct v9fs_session_info *v9ses, int mode) | 103 | struct p9_wstat *stat, dev_t *rdev) |
103 | { | 104 | { |
104 | int res; | 105 | int res; |
106 | int mode = stat->mode; | ||
105 | 107 | ||
106 | res = mode & 0777; | 108 | res = mode & S_IALLUGO; |
109 | *rdev = 0; | ||
107 | 110 | ||
108 | if ((mode & P9_DMDIR) == P9_DMDIR) | 111 | if ((mode & P9_DMDIR) == P9_DMDIR) |
109 | res |= S_IFDIR; | 112 | res |= S_IFDIR; |
@@ -116,9 +119,26 @@ static int p9mode2unixmode(struct v9fs_session_info *v9ses, int mode) | |||
116 | && (v9ses->nodev == 0)) | 119 | && (v9ses->nodev == 0)) |
117 | res |= S_IFIFO; | 120 | res |= S_IFIFO; |
118 | else if ((mode & P9_DMDEVICE) && (v9fs_proto_dotu(v9ses)) | 121 | else if ((mode & P9_DMDEVICE) && (v9fs_proto_dotu(v9ses)) |
119 | && (v9ses->nodev == 0)) | 122 | && (v9ses->nodev == 0)) { |
120 | res |= S_IFBLK; | 123 | char type = 0, ext[32]; |
121 | else | 124 | int major = -1, minor = -1; |
125 | |||
126 | strncpy(ext, stat->extension, sizeof(ext)); | ||
127 | sscanf(ext, "%c %u %u", &type, &major, &minor); | ||
128 | switch (type) { | ||
129 | case 'c': | ||
130 | res |= S_IFCHR; | ||
131 | break; | ||
132 | case 'b': | ||
133 | res |= S_IFBLK; | ||
134 | break; | ||
135 | default: | ||
136 | P9_DPRINTK(P9_DEBUG_ERROR, | ||
137 | "Unknown special type %c %s\n", type, | ||
138 | stat->extension); | ||
139 | }; | ||
140 | *rdev = MKDEV(major, minor); | ||
141 | } else | ||
122 | res |= S_IFREG; | 142 | res |= S_IFREG; |
123 | 143 | ||
124 | if (v9fs_proto_dotu(v9ses)) { | 144 | if (v9fs_proto_dotu(v9ses)) { |
@@ -131,7 +151,6 @@ static int p9mode2unixmode(struct v9fs_session_info *v9ses, int mode) | |||
131 | if ((mode & P9_DMSETVTX) == P9_DMSETVTX) | 151 | if ((mode & P9_DMSETVTX) == P9_DMSETVTX) |
132 | res |= S_ISVTX; | 152 | res |= S_ISVTX; |
133 | } | 153 | } |
134 | |||
135 | return res; | 154 | return res; |
136 | } | 155 | } |
137 | 156 | ||
@@ -242,13 +261,13 @@ void v9fs_destroy_inode(struct inode *inode) | |||
242 | } | 261 | } |
243 | 262 | ||
244 | int v9fs_init_inode(struct v9fs_session_info *v9ses, | 263 | int v9fs_init_inode(struct v9fs_session_info *v9ses, |
245 | struct inode *inode, int mode) | 264 | struct inode *inode, int mode, dev_t rdev) |
246 | { | 265 | { |
247 | int err = 0; | 266 | int err = 0; |
248 | 267 | ||
249 | inode_init_owner(inode, NULL, mode); | 268 | inode_init_owner(inode, NULL, mode); |
250 | inode->i_blocks = 0; | 269 | inode->i_blocks = 0; |
251 | inode->i_rdev = 0; | 270 | inode->i_rdev = rdev; |
252 | inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME; | 271 | inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME; |
253 | inode->i_mapping->a_ops = &v9fs_addr_operations; | 272 | inode->i_mapping->a_ops = &v9fs_addr_operations; |
254 | 273 | ||
@@ -335,7 +354,7 @@ error: | |||
335 | * | 354 | * |
336 | */ | 355 | */ |
337 | 356 | ||
338 | struct inode *v9fs_get_inode(struct super_block *sb, int mode) | 357 | struct inode *v9fs_get_inode(struct super_block *sb, int mode, dev_t rdev) |
339 | { | 358 | { |
340 | int err; | 359 | int err; |
341 | struct inode *inode; | 360 | struct inode *inode; |
@@ -348,7 +367,7 @@ struct inode *v9fs_get_inode(struct super_block *sb, int mode) | |||
348 | P9_EPRINTK(KERN_WARNING, "Problem allocating inode\n"); | 367 | P9_EPRINTK(KERN_WARNING, "Problem allocating inode\n"); |
349 | return ERR_PTR(-ENOMEM); | 368 | return ERR_PTR(-ENOMEM); |
350 | } | 369 | } |
351 | err = v9fs_init_inode(v9ses, inode, mode); | 370 | err = v9fs_init_inode(v9ses, inode, mode, rdev); |
352 | if (err) { | 371 | if (err) { |
353 | iput(inode); | 372 | iput(inode); |
354 | return ERR_PTR(err); | 373 | return ERR_PTR(err); |
@@ -435,11 +454,12 @@ void v9fs_evict_inode(struct inode *inode) | |||
435 | static int v9fs_test_inode(struct inode *inode, void *data) | 454 | static int v9fs_test_inode(struct inode *inode, void *data) |
436 | { | 455 | { |
437 | int umode; | 456 | int umode; |
457 | dev_t rdev; | ||
438 | struct v9fs_inode *v9inode = V9FS_I(inode); | 458 | struct v9fs_inode *v9inode = V9FS_I(inode); |
439 | struct p9_wstat *st = (struct p9_wstat *)data; | 459 | struct p9_wstat *st = (struct p9_wstat *)data; |
440 | struct v9fs_session_info *v9ses = v9fs_inode2v9ses(inode); | 460 | struct v9fs_session_info *v9ses = v9fs_inode2v9ses(inode); |
441 | 461 | ||
442 | umode = p9mode2unixmode(v9ses, st->mode); | 462 | umode = p9mode2unixmode(v9ses, st, &rdev); |
443 | /* don't match inode of different type */ | 463 | /* don't match inode of different type */ |
444 | if ((inode->i_mode & S_IFMT) != (umode & S_IFMT)) | 464 | if ((inode->i_mode & S_IFMT) != (umode & S_IFMT)) |
445 | return 0; | 465 | return 0; |
@@ -473,6 +493,7 @@ static struct inode *v9fs_qid_iget(struct super_block *sb, | |||
473 | struct p9_wstat *st, | 493 | struct p9_wstat *st, |
474 | int new) | 494 | int new) |
475 | { | 495 | { |
496 | dev_t rdev; | ||
476 | int retval, umode; | 497 | int retval, umode; |
477 | unsigned long i_ino; | 498 | unsigned long i_ino; |
478 | struct inode *inode; | 499 | struct inode *inode; |
@@ -496,8 +517,8 @@ static struct inode *v9fs_qid_iget(struct super_block *sb, | |||
496 | * later. | 517 | * later. |
497 | */ | 518 | */ |
498 | inode->i_ino = i_ino; | 519 | inode->i_ino = i_ino; |
499 | umode = p9mode2unixmode(v9ses, st->mode); | 520 | umode = p9mode2unixmode(v9ses, st, &rdev); |
500 | retval = v9fs_init_inode(v9ses, inode, umode); | 521 | retval = v9fs_init_inode(v9ses, inode, umode, rdev); |
501 | if (retval) | 522 | if (retval) |
502 | goto error; | 523 | goto error; |
503 | 524 | ||
@@ -532,6 +553,19 @@ v9fs_inode_from_fid(struct v9fs_session_info *v9ses, struct p9_fid *fid, | |||
532 | } | 553 | } |
533 | 554 | ||
534 | /** | 555 | /** |
556 | * v9fs_at_to_dotl_flags- convert Linux specific AT flags to | ||
557 | * plan 9 AT flag. | ||
558 | * @flags: flags to convert | ||
559 | */ | ||
560 | static int v9fs_at_to_dotl_flags(int flags) | ||
561 | { | ||
562 | int rflags = 0; | ||
563 | if (flags & AT_REMOVEDIR) | ||
564 | rflags |= P9_DOTL_AT_REMOVEDIR; | ||
565 | return rflags; | ||
566 | } | ||
567 | |||
568 | /** | ||
535 | * v9fs_remove - helper function to remove files and directories | 569 | * v9fs_remove - helper function to remove files and directories |
536 | * @dir: directory inode that is being deleted | 570 | * @dir: directory inode that is being deleted |
537 | * @dentry: dentry that is being deleted | 571 | * @dentry: dentry that is being deleted |
@@ -558,7 +592,8 @@ static int v9fs_remove(struct inode *dir, struct dentry *dentry, int flags) | |||
558 | return retval; | 592 | return retval; |
559 | } | 593 | } |
560 | if (v9fs_proto_dotl(v9ses)) | 594 | if (v9fs_proto_dotl(v9ses)) |
561 | retval = p9_client_unlinkat(dfid, dentry->d_name.name, flags); | 595 | retval = p9_client_unlinkat(dfid, dentry->d_name.name, |
596 | v9fs_at_to_dotl_flags(flags)); | ||
562 | if (retval == -EOPNOTSUPP) { | 597 | if (retval == -EOPNOTSUPP) { |
563 | /* Try the one based on path */ | 598 | /* Try the one based on path */ |
564 | v9fid = v9fs_fid_clone(dentry); | 599 | v9fid = v9fs_fid_clone(dentry); |
@@ -645,13 +680,11 @@ v9fs_create(struct v9fs_session_info *v9ses, struct inode *dir, | |||
645 | P9_DPRINTK(P9_DEBUG_VFS, "inode creation failed %d\n", err); | 680 | P9_DPRINTK(P9_DEBUG_VFS, "inode creation failed %d\n", err); |
646 | goto error; | 681 | goto error; |
647 | } | 682 | } |
648 | d_instantiate(dentry, inode); | ||
649 | err = v9fs_fid_add(dentry, fid); | 683 | err = v9fs_fid_add(dentry, fid); |
650 | if (err < 0) | 684 | if (err < 0) |
651 | goto error; | 685 | goto error; |
652 | 686 | d_instantiate(dentry, inode); | |
653 | return ofid; | 687 | return ofid; |
654 | |||
655 | error: | 688 | error: |
656 | if (ofid) | 689 | if (ofid) |
657 | p9_client_clunk(ofid); | 690 | p9_client_clunk(ofid); |
@@ -792,6 +825,7 @@ static int v9fs_vfs_mkdir(struct inode *dir, struct dentry *dentry, int mode) | |||
792 | struct dentry *v9fs_vfs_lookup(struct inode *dir, struct dentry *dentry, | 825 | struct dentry *v9fs_vfs_lookup(struct inode *dir, struct dentry *dentry, |
793 | struct nameidata *nameidata) | 826 | struct nameidata *nameidata) |
794 | { | 827 | { |
828 | struct dentry *res; | ||
795 | struct super_block *sb; | 829 | struct super_block *sb; |
796 | struct v9fs_session_info *v9ses; | 830 | struct v9fs_session_info *v9ses; |
797 | struct p9_fid *dfid, *fid; | 831 | struct p9_fid *dfid, *fid; |
@@ -823,22 +857,35 @@ struct dentry *v9fs_vfs_lookup(struct inode *dir, struct dentry *dentry, | |||
823 | 857 | ||
824 | return ERR_PTR(result); | 858 | return ERR_PTR(result); |
825 | } | 859 | } |
826 | 860 | /* | |
827 | inode = v9fs_get_inode_from_fid(v9ses, fid, dir->i_sb); | 861 | * Make sure we don't use a wrong inode due to parallel |
862 | * unlink. For cached mode create calls request for new | ||
863 | * inode. But with cache disabled, lookup should do this. | ||
864 | */ | ||
865 | if (v9ses->cache) | ||
866 | inode = v9fs_get_inode_from_fid(v9ses, fid, dir->i_sb); | ||
867 | else | ||
868 | inode = v9fs_get_new_inode_from_fid(v9ses, fid, dir->i_sb); | ||
828 | if (IS_ERR(inode)) { | 869 | if (IS_ERR(inode)) { |
829 | result = PTR_ERR(inode); | 870 | result = PTR_ERR(inode); |
830 | inode = NULL; | 871 | inode = NULL; |
831 | goto error; | 872 | goto error; |
832 | } | 873 | } |
833 | |||
834 | result = v9fs_fid_add(dentry, fid); | 874 | result = v9fs_fid_add(dentry, fid); |
835 | if (result < 0) | 875 | if (result < 0) |
836 | goto error_iput; | 876 | goto error_iput; |
837 | |||
838 | inst_out: | 877 | inst_out: |
839 | d_add(dentry, inode); | 878 | /* |
840 | return NULL; | 879 | * If we had a rename on the server and a parallel lookup |
841 | 880 | * for the new name, then make sure we instantiate with | |
881 | * the new name. ie look up for a/b, while on server somebody | ||
882 | * moved b under k and client parallely did a lookup for | ||
883 | * k/b. | ||
884 | */ | ||
885 | res = d_materialise_unique(dentry, inode); | ||
886 | if (!IS_ERR(res)) | ||
887 | return res; | ||
888 | result = PTR_ERR(res); | ||
842 | error_iput: | 889 | error_iput: |
843 | iput(inode); | 890 | iput(inode); |
844 | error: | 891 | error: |
@@ -1002,7 +1049,7 @@ v9fs_vfs_getattr(struct vfsmount *mnt, struct dentry *dentry, | |||
1002 | return PTR_ERR(st); | 1049 | return PTR_ERR(st); |
1003 | 1050 | ||
1004 | v9fs_stat2inode(st, dentry->d_inode, dentry->d_inode->i_sb); | 1051 | v9fs_stat2inode(st, dentry->d_inode, dentry->d_inode->i_sb); |
1005 | generic_fillattr(dentry->d_inode, stat); | 1052 | generic_fillattr(dentry->d_inode, stat); |
1006 | 1053 | ||
1007 | p9stat_free(st); | 1054 | p9stat_free(st); |
1008 | kfree(st); | 1055 | kfree(st); |
@@ -1086,6 +1133,7 @@ void | |||
1086 | v9fs_stat2inode(struct p9_wstat *stat, struct inode *inode, | 1133 | v9fs_stat2inode(struct p9_wstat *stat, struct inode *inode, |
1087 | struct super_block *sb) | 1134 | struct super_block *sb) |
1088 | { | 1135 | { |
1136 | mode_t mode; | ||
1089 | char ext[32]; | 1137 | char ext[32]; |
1090 | char tag_name[14]; | 1138 | char tag_name[14]; |
1091 | unsigned int i_nlink; | 1139 | unsigned int i_nlink; |
@@ -1121,31 +1169,9 @@ v9fs_stat2inode(struct p9_wstat *stat, struct inode *inode, | |||
1121 | inode->i_nlink = i_nlink; | 1169 | inode->i_nlink = i_nlink; |
1122 | } | 1170 | } |
1123 | } | 1171 | } |
1124 | inode->i_mode = p9mode2unixmode(v9ses, stat->mode); | 1172 | mode = stat->mode & S_IALLUGO; |
1125 | if ((S_ISBLK(inode->i_mode)) || (S_ISCHR(inode->i_mode))) { | 1173 | mode |= inode->i_mode & ~S_IALLUGO; |
1126 | char type = 0; | 1174 | inode->i_mode = mode; |
1127 | int major = -1; | ||
1128 | int minor = -1; | ||
1129 | |||
1130 | strncpy(ext, stat->extension, sizeof(ext)); | ||
1131 | sscanf(ext, "%c %u %u", &type, &major, &minor); | ||
1132 | switch (type) { | ||
1133 | case 'c': | ||
1134 | inode->i_mode &= ~S_IFBLK; | ||
1135 | inode->i_mode |= S_IFCHR; | ||
1136 | break; | ||
1137 | case 'b': | ||
1138 | break; | ||
1139 | default: | ||
1140 | P9_DPRINTK(P9_DEBUG_ERROR, | ||
1141 | "Unknown special type %c %s\n", type, | ||
1142 | stat->extension); | ||
1143 | }; | ||
1144 | inode->i_rdev = MKDEV(major, minor); | ||
1145 | init_special_inode(inode, inode->i_mode, inode->i_rdev); | ||
1146 | } else | ||
1147 | inode->i_rdev = 0; | ||
1148 | |||
1149 | i_size_write(inode, stat->length); | 1175 | i_size_write(inode, stat->length); |
1150 | 1176 | ||
1151 | /* not real number of blocks, but 512 byte ones ... */ | 1177 | /* not real number of blocks, but 512 byte ones ... */ |
@@ -1411,6 +1437,8 @@ v9fs_vfs_mknod(struct inode *dir, struct dentry *dentry, int mode, dev_t rdev) | |||
1411 | 1437 | ||
1412 | int v9fs_refresh_inode(struct p9_fid *fid, struct inode *inode) | 1438 | int v9fs_refresh_inode(struct p9_fid *fid, struct inode *inode) |
1413 | { | 1439 | { |
1440 | int umode; | ||
1441 | dev_t rdev; | ||
1414 | loff_t i_size; | 1442 | loff_t i_size; |
1415 | struct p9_wstat *st; | 1443 | struct p9_wstat *st; |
1416 | struct v9fs_session_info *v9ses; | 1444 | struct v9fs_session_info *v9ses; |
@@ -1419,6 +1447,12 @@ int v9fs_refresh_inode(struct p9_fid *fid, struct inode *inode) | |||
1419 | st = p9_client_stat(fid); | 1447 | st = p9_client_stat(fid); |
1420 | if (IS_ERR(st)) | 1448 | if (IS_ERR(st)) |
1421 | return PTR_ERR(st); | 1449 | return PTR_ERR(st); |
1450 | /* | ||
1451 | * Don't update inode if the file type is different | ||
1452 | */ | ||
1453 | umode = p9mode2unixmode(v9ses, st, &rdev); | ||
1454 | if ((inode->i_mode & S_IFMT) != (umode & S_IFMT)) | ||
1455 | goto out; | ||
1422 | 1456 | ||
1423 | spin_lock(&inode->i_lock); | 1457 | spin_lock(&inode->i_lock); |
1424 | /* | 1458 | /* |
@@ -1430,6 +1464,7 @@ int v9fs_refresh_inode(struct p9_fid *fid, struct inode *inode) | |||
1430 | if (v9ses->cache) | 1464 | if (v9ses->cache) |
1431 | inode->i_size = i_size; | 1465 | inode->i_size = i_size; |
1432 | spin_unlock(&inode->i_lock); | 1466 | spin_unlock(&inode->i_lock); |
1467 | out: | ||
1433 | p9stat_free(st); | 1468 | p9stat_free(st); |
1434 | kfree(st); | 1469 | kfree(st); |
1435 | return 0; | 1470 | return 0; |
diff --git a/fs/9p/vfs_inode_dotl.c b/fs/9p/vfs_inode_dotl.c index b6c8ed205192..aded79fcd5cf 100644 --- a/fs/9p/vfs_inode_dotl.c +++ b/fs/9p/vfs_inode_dotl.c | |||
@@ -153,7 +153,8 @@ static struct inode *v9fs_qid_iget_dotl(struct super_block *sb, | |||
153 | * later. | 153 | * later. |
154 | */ | 154 | */ |
155 | inode->i_ino = i_ino; | 155 | inode->i_ino = i_ino; |
156 | retval = v9fs_init_inode(v9ses, inode, st->st_mode); | 156 | retval = v9fs_init_inode(v9ses, inode, |
157 | st->st_mode, new_decode_dev(st->st_rdev)); | ||
157 | if (retval) | 158 | if (retval) |
158 | goto error; | 159 | goto error; |
159 | 160 | ||
@@ -190,6 +191,58 @@ v9fs_inode_from_fid_dotl(struct v9fs_session_info *v9ses, struct p9_fid *fid, | |||
190 | return inode; | 191 | return inode; |
191 | } | 192 | } |
192 | 193 | ||
194 | struct dotl_openflag_map { | ||
195 | int open_flag; | ||
196 | int dotl_flag; | ||
197 | }; | ||
198 | |||
199 | static int v9fs_mapped_dotl_flags(int flags) | ||
200 | { | ||
201 | int i; | ||
202 | int rflags = 0; | ||
203 | struct dotl_openflag_map dotl_oflag_map[] = { | ||
204 | { O_CREAT, P9_DOTL_CREATE }, | ||
205 | { O_EXCL, P9_DOTL_EXCL }, | ||
206 | { O_NOCTTY, P9_DOTL_NOCTTY }, | ||
207 | { O_TRUNC, P9_DOTL_TRUNC }, | ||
208 | { O_APPEND, P9_DOTL_APPEND }, | ||
209 | { O_NONBLOCK, P9_DOTL_NONBLOCK }, | ||
210 | { O_DSYNC, P9_DOTL_DSYNC }, | ||
211 | { FASYNC, P9_DOTL_FASYNC }, | ||
212 | { O_DIRECT, P9_DOTL_DIRECT }, | ||
213 | { O_LARGEFILE, P9_DOTL_LARGEFILE }, | ||
214 | { O_DIRECTORY, P9_DOTL_DIRECTORY }, | ||
215 | { O_NOFOLLOW, P9_DOTL_NOFOLLOW }, | ||
216 | { O_NOATIME, P9_DOTL_NOATIME }, | ||
217 | { O_CLOEXEC, P9_DOTL_CLOEXEC }, | ||
218 | { O_SYNC, P9_DOTL_SYNC}, | ||
219 | }; | ||
220 | for (i = 0; i < ARRAY_SIZE(dotl_oflag_map); i++) { | ||
221 | if (flags & dotl_oflag_map[i].open_flag) | ||
222 | rflags |= dotl_oflag_map[i].dotl_flag; | ||
223 | } | ||
224 | return rflags; | ||
225 | } | ||
226 | |||
227 | /** | ||
228 | * v9fs_open_to_dotl_flags- convert Linux specific open flags to | ||
229 | * plan 9 open flag. | ||
230 | * @flags: flags to convert | ||
231 | */ | ||
232 | int v9fs_open_to_dotl_flags(int flags) | ||
233 | { | ||
234 | int rflags = 0; | ||
235 | |||
236 | /* | ||
237 | * We have same bits for P9_DOTL_READONLY, P9_DOTL_WRONLY | ||
238 | * and P9_DOTL_NOACCESS | ||
239 | */ | ||
240 | rflags |= flags & O_ACCMODE; | ||
241 | rflags |= v9fs_mapped_dotl_flags(flags); | ||
242 | |||
243 | return rflags; | ||
244 | } | ||
245 | |||
193 | /** | 246 | /** |
194 | * v9fs_vfs_create_dotl - VFS hook to create files for 9P2000.L protocol. | 247 | * v9fs_vfs_create_dotl - VFS hook to create files for 9P2000.L protocol. |
195 | * @dir: directory inode that is being created | 248 | * @dir: directory inode that is being created |
@@ -258,7 +311,8 @@ v9fs_vfs_create_dotl(struct inode *dir, struct dentry *dentry, int omode, | |||
258 | "Failed to get acl values in creat %d\n", err); | 311 | "Failed to get acl values in creat %d\n", err); |
259 | goto error; | 312 | goto error; |
260 | } | 313 | } |
261 | err = p9_client_create_dotl(ofid, name, flags, mode, gid, &qid); | 314 | err = p9_client_create_dotl(ofid, name, v9fs_open_to_dotl_flags(flags), |
315 | mode, gid, &qid); | ||
262 | if (err < 0) { | 316 | if (err < 0) { |
263 | P9_DPRINTK(P9_DEBUG_VFS, | 317 | P9_DPRINTK(P9_DEBUG_VFS, |
264 | "p9_client_open_dotl failed in creat %d\n", | 318 | "p9_client_open_dotl failed in creat %d\n", |
@@ -281,10 +335,10 @@ v9fs_vfs_create_dotl(struct inode *dir, struct dentry *dentry, int omode, | |||
281 | P9_DPRINTK(P9_DEBUG_VFS, "inode creation failed %d\n", err); | 335 | P9_DPRINTK(P9_DEBUG_VFS, "inode creation failed %d\n", err); |
282 | goto error; | 336 | goto error; |
283 | } | 337 | } |
284 | d_instantiate(dentry, inode); | ||
285 | err = v9fs_fid_add(dentry, fid); | 338 | err = v9fs_fid_add(dentry, fid); |
286 | if (err < 0) | 339 | if (err < 0) |
287 | goto error; | 340 | goto error; |
341 | d_instantiate(dentry, inode); | ||
288 | 342 | ||
289 | /* Now set the ACL based on the default value */ | 343 | /* Now set the ACL based on the default value */ |
290 | v9fs_set_create_acl(dentry, &dacl, &pacl); | 344 | v9fs_set_create_acl(dentry, &dacl, &pacl); |
@@ -403,10 +457,10 @@ static int v9fs_vfs_mkdir_dotl(struct inode *dir, | |||
403 | err); | 457 | err); |
404 | goto error; | 458 | goto error; |
405 | } | 459 | } |
406 | d_instantiate(dentry, inode); | ||
407 | err = v9fs_fid_add(dentry, fid); | 460 | err = v9fs_fid_add(dentry, fid); |
408 | if (err < 0) | 461 | if (err < 0) |
409 | goto error; | 462 | goto error; |
463 | d_instantiate(dentry, inode); | ||
410 | fid = NULL; | 464 | fid = NULL; |
411 | } else { | 465 | } else { |
412 | /* | 466 | /* |
@@ -414,7 +468,7 @@ static int v9fs_vfs_mkdir_dotl(struct inode *dir, | |||
414 | * inode with stat. We need to get an inode | 468 | * inode with stat. We need to get an inode |
415 | * so that we can set the acl with dentry | 469 | * so that we can set the acl with dentry |
416 | */ | 470 | */ |
417 | inode = v9fs_get_inode(dir->i_sb, mode); | 471 | inode = v9fs_get_inode(dir->i_sb, mode, 0); |
418 | if (IS_ERR(inode)) { | 472 | if (IS_ERR(inode)) { |
419 | err = PTR_ERR(inode); | 473 | err = PTR_ERR(inode); |
420 | goto error; | 474 | goto error; |
@@ -540,6 +594,7 @@ int v9fs_vfs_setattr_dotl(struct dentry *dentry, struct iattr *iattr) | |||
540 | void | 594 | void |
541 | v9fs_stat2inode_dotl(struct p9_stat_dotl *stat, struct inode *inode) | 595 | v9fs_stat2inode_dotl(struct p9_stat_dotl *stat, struct inode *inode) |
542 | { | 596 | { |
597 | mode_t mode; | ||
543 | struct v9fs_inode *v9inode = V9FS_I(inode); | 598 | struct v9fs_inode *v9inode = V9FS_I(inode); |
544 | 599 | ||
545 | if ((stat->st_result_mask & P9_STATS_BASIC) == P9_STATS_BASIC) { | 600 | if ((stat->st_result_mask & P9_STATS_BASIC) == P9_STATS_BASIC) { |
@@ -552,11 +607,10 @@ v9fs_stat2inode_dotl(struct p9_stat_dotl *stat, struct inode *inode) | |||
552 | inode->i_uid = stat->st_uid; | 607 | inode->i_uid = stat->st_uid; |
553 | inode->i_gid = stat->st_gid; | 608 | inode->i_gid = stat->st_gid; |
554 | inode->i_nlink = stat->st_nlink; | 609 | inode->i_nlink = stat->st_nlink; |
555 | inode->i_mode = stat->st_mode; | ||
556 | inode->i_rdev = new_decode_dev(stat->st_rdev); | ||
557 | 610 | ||
558 | if ((S_ISBLK(inode->i_mode)) || (S_ISCHR(inode->i_mode))) | 611 | mode = stat->st_mode & S_IALLUGO; |
559 | init_special_inode(inode, inode->i_mode, inode->i_rdev); | 612 | mode |= inode->i_mode & ~S_IALLUGO; |
613 | inode->i_mode = mode; | ||
560 | 614 | ||
561 | i_size_write(inode, stat->st_size); | 615 | i_size_write(inode, stat->st_size); |
562 | inode->i_blocks = stat->st_blocks; | 616 | inode->i_blocks = stat->st_blocks; |
@@ -657,14 +711,14 @@ v9fs_vfs_symlink_dotl(struct inode *dir, struct dentry *dentry, | |||
657 | err); | 711 | err); |
658 | goto error; | 712 | goto error; |
659 | } | 713 | } |
660 | d_instantiate(dentry, inode); | ||
661 | err = v9fs_fid_add(dentry, fid); | 714 | err = v9fs_fid_add(dentry, fid); |
662 | if (err < 0) | 715 | if (err < 0) |
663 | goto error; | 716 | goto error; |
717 | d_instantiate(dentry, inode); | ||
664 | fid = NULL; | 718 | fid = NULL; |
665 | } else { | 719 | } else { |
666 | /* Not in cached mode. No need to populate inode with stat */ | 720 | /* Not in cached mode. No need to populate inode with stat */ |
667 | inode = v9fs_get_inode(dir->i_sb, S_IFLNK); | 721 | inode = v9fs_get_inode(dir->i_sb, S_IFLNK, 0); |
668 | if (IS_ERR(inode)) { | 722 | if (IS_ERR(inode)) { |
669 | err = PTR_ERR(inode); | 723 | err = PTR_ERR(inode); |
670 | goto error; | 724 | goto error; |
@@ -810,17 +864,17 @@ v9fs_vfs_mknod_dotl(struct inode *dir, struct dentry *dentry, int omode, | |||
810 | err); | 864 | err); |
811 | goto error; | 865 | goto error; |
812 | } | 866 | } |
813 | d_instantiate(dentry, inode); | ||
814 | err = v9fs_fid_add(dentry, fid); | 867 | err = v9fs_fid_add(dentry, fid); |
815 | if (err < 0) | 868 | if (err < 0) |
816 | goto error; | 869 | goto error; |
870 | d_instantiate(dentry, inode); | ||
817 | fid = NULL; | 871 | fid = NULL; |
818 | } else { | 872 | } else { |
819 | /* | 873 | /* |
820 | * Not in cached mode. No need to populate inode with stat. | 874 | * Not in cached mode. No need to populate inode with stat. |
821 | * socket syscall returns a fd, so we need instantiate | 875 | * socket syscall returns a fd, so we need instantiate |
822 | */ | 876 | */ |
823 | inode = v9fs_get_inode(dir->i_sb, mode); | 877 | inode = v9fs_get_inode(dir->i_sb, mode, rdev); |
824 | if (IS_ERR(inode)) { | 878 | if (IS_ERR(inode)) { |
825 | err = PTR_ERR(inode); | 879 | err = PTR_ERR(inode); |
826 | goto error; | 880 | goto error; |
@@ -886,6 +940,11 @@ int v9fs_refresh_inode_dotl(struct p9_fid *fid, struct inode *inode) | |||
886 | st = p9_client_getattr_dotl(fid, P9_STATS_ALL); | 940 | st = p9_client_getattr_dotl(fid, P9_STATS_ALL); |
887 | if (IS_ERR(st)) | 941 | if (IS_ERR(st)) |
888 | return PTR_ERR(st); | 942 | return PTR_ERR(st); |
943 | /* | ||
944 | * Don't update inode if the file type is different | ||
945 | */ | ||
946 | if ((inode->i_mode & S_IFMT) != (st->st_mode & S_IFMT)) | ||
947 | goto out; | ||
889 | 948 | ||
890 | spin_lock(&inode->i_lock); | 949 | spin_lock(&inode->i_lock); |
891 | /* | 950 | /* |
@@ -897,6 +956,7 @@ int v9fs_refresh_inode_dotl(struct p9_fid *fid, struct inode *inode) | |||
897 | if (v9ses->cache) | 956 | if (v9ses->cache) |
898 | inode->i_size = i_size; | 957 | inode->i_size = i_size; |
899 | spin_unlock(&inode->i_lock); | 958 | spin_unlock(&inode->i_lock); |
959 | out: | ||
900 | kfree(st); | 960 | kfree(st); |
901 | return 0; | 961 | return 0; |
902 | } | 962 | } |
diff --git a/fs/9p/vfs_super.c b/fs/9p/vfs_super.c index feef6cdc1fd2..c70251d47ed1 100644 --- a/fs/9p/vfs_super.c +++ b/fs/9p/vfs_super.c | |||
@@ -149,7 +149,7 @@ static struct dentry *v9fs_mount(struct file_system_type *fs_type, int flags, | |||
149 | else | 149 | else |
150 | sb->s_d_op = &v9fs_dentry_operations; | 150 | sb->s_d_op = &v9fs_dentry_operations; |
151 | 151 | ||
152 | inode = v9fs_get_inode(sb, S_IFDIR | mode); | 152 | inode = v9fs_get_inode(sb, S_IFDIR | mode, 0); |
153 | if (IS_ERR(inode)) { | 153 | if (IS_ERR(inode)) { |
154 | retval = PTR_ERR(inode); | 154 | retval = PTR_ERR(inode); |
155 | goto release_sb; | 155 | goto release_sb; |
diff --git a/fs/block_dev.c b/fs/block_dev.c index ff77262e887c..95f786ec7f08 100644 --- a/fs/block_dev.c +++ b/fs/block_dev.c | |||
@@ -1429,6 +1429,11 @@ static int __blkdev_put(struct block_device *bdev, fmode_t mode, int for_part) | |||
1429 | WARN_ON_ONCE(bdev->bd_holders); | 1429 | WARN_ON_ONCE(bdev->bd_holders); |
1430 | sync_blockdev(bdev); | 1430 | sync_blockdev(bdev); |
1431 | kill_bdev(bdev); | 1431 | kill_bdev(bdev); |
1432 | /* ->release can cause the old bdi to disappear, | ||
1433 | * so must switch it out first | ||
1434 | */ | ||
1435 | bdev_inode_switch_bdi(bdev->bd_inode, | ||
1436 | &default_backing_dev_info); | ||
1432 | } | 1437 | } |
1433 | if (bdev->bd_contains == bdev) { | 1438 | if (bdev->bd_contains == bdev) { |
1434 | if (disk->fops->release) | 1439 | if (disk->fops->release) |
@@ -1442,8 +1447,6 @@ static int __blkdev_put(struct block_device *bdev, fmode_t mode, int for_part) | |||
1442 | disk_put_part(bdev->bd_part); | 1447 | disk_put_part(bdev->bd_part); |
1443 | bdev->bd_part = NULL; | 1448 | bdev->bd_part = NULL; |
1444 | bdev->bd_disk = NULL; | 1449 | bdev->bd_disk = NULL; |
1445 | bdev_inode_switch_bdi(bdev->bd_inode, | ||
1446 | &default_backing_dev_info); | ||
1447 | if (bdev != bdev->bd_contains) | 1450 | if (bdev != bdev->bd_contains) |
1448 | victim = bdev->bd_contains; | 1451 | victim = bdev->bd_contains; |
1449 | bdev->bd_contains = NULL; | 1452 | bdev->bd_contains = NULL; |
diff --git a/fs/btrfs/btrfs_inode.h b/fs/btrfs/btrfs_inode.h index 502b9e988679..d9f99a16edd6 100644 --- a/fs/btrfs/btrfs_inode.h +++ b/fs/btrfs/btrfs_inode.h | |||
@@ -176,7 +176,11 @@ static inline u64 btrfs_ino(struct inode *inode) | |||
176 | { | 176 | { |
177 | u64 ino = BTRFS_I(inode)->location.objectid; | 177 | u64 ino = BTRFS_I(inode)->location.objectid; |
178 | 178 | ||
179 | if (ino <= BTRFS_FIRST_FREE_OBJECTID) | 179 | /* |
180 | * !ino: btree_inode | ||
181 | * type == BTRFS_ROOT_ITEM_KEY: subvol dir | ||
182 | */ | ||
183 | if (!ino || BTRFS_I(inode)->location.type == BTRFS_ROOT_ITEM_KEY) | ||
180 | ino = inode->i_ino; | 184 | ino = inode->i_ino; |
181 | return ino; | 185 | return ino; |
182 | } | 186 | } |
diff --git a/fs/btrfs/file-item.c b/fs/btrfs/file-item.c index b910694f61ed..a1cb7821becd 100644 --- a/fs/btrfs/file-item.c +++ b/fs/btrfs/file-item.c | |||
@@ -183,8 +183,10 @@ static int __btrfs_lookup_bio_sums(struct btrfs_root *root, | |||
183 | * read from the commit root and sidestep a nasty deadlock | 183 | * read from the commit root and sidestep a nasty deadlock |
184 | * between reading the free space cache and updating the csum tree. | 184 | * between reading the free space cache and updating the csum tree. |
185 | */ | 185 | */ |
186 | if (btrfs_is_free_space_inode(root, inode)) | 186 | if (btrfs_is_free_space_inode(root, inode)) { |
187 | path->search_commit_root = 1; | 187 | path->search_commit_root = 1; |
188 | path->skip_locking = 1; | ||
189 | } | ||
188 | 190 | ||
189 | disk_bytenr = (u64)bio->bi_sector << 9; | 191 | disk_bytenr = (u64)bio->bi_sector << 9; |
190 | if (dio) | 192 | if (dio) |
diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c index e7872e485f13..e4e57d59edb7 100644 --- a/fs/btrfs/file.c +++ b/fs/btrfs/file.c | |||
@@ -1036,11 +1036,13 @@ out: | |||
1036 | * on error we return an unlocked page and the error value | 1036 | * on error we return an unlocked page and the error value |
1037 | * on success we return a locked page and 0 | 1037 | * on success we return a locked page and 0 |
1038 | */ | 1038 | */ |
1039 | static int prepare_uptodate_page(struct page *page, u64 pos) | 1039 | static int prepare_uptodate_page(struct page *page, u64 pos, |
1040 | bool force_uptodate) | ||
1040 | { | 1041 | { |
1041 | int ret = 0; | 1042 | int ret = 0; |
1042 | 1043 | ||
1043 | if ((pos & (PAGE_CACHE_SIZE - 1)) && !PageUptodate(page)) { | 1044 | if (((pos & (PAGE_CACHE_SIZE - 1)) || force_uptodate) && |
1045 | !PageUptodate(page)) { | ||
1044 | ret = btrfs_readpage(NULL, page); | 1046 | ret = btrfs_readpage(NULL, page); |
1045 | if (ret) | 1047 | if (ret) |
1046 | return ret; | 1048 | return ret; |
@@ -1061,7 +1063,7 @@ static int prepare_uptodate_page(struct page *page, u64 pos) | |||
1061 | static noinline int prepare_pages(struct btrfs_root *root, struct file *file, | 1063 | static noinline int prepare_pages(struct btrfs_root *root, struct file *file, |
1062 | struct page **pages, size_t num_pages, | 1064 | struct page **pages, size_t num_pages, |
1063 | loff_t pos, unsigned long first_index, | 1065 | loff_t pos, unsigned long first_index, |
1064 | size_t write_bytes) | 1066 | size_t write_bytes, bool force_uptodate) |
1065 | { | 1067 | { |
1066 | struct extent_state *cached_state = NULL; | 1068 | struct extent_state *cached_state = NULL; |
1067 | int i; | 1069 | int i; |
@@ -1075,12 +1077,6 @@ static noinline int prepare_pages(struct btrfs_root *root, struct file *file, | |||
1075 | start_pos = pos & ~((u64)root->sectorsize - 1); | 1077 | start_pos = pos & ~((u64)root->sectorsize - 1); |
1076 | last_pos = ((u64)index + num_pages) << PAGE_CACHE_SHIFT; | 1078 | last_pos = ((u64)index + num_pages) << PAGE_CACHE_SHIFT; |
1077 | 1079 | ||
1078 | if (start_pos > inode->i_size) { | ||
1079 | err = btrfs_cont_expand(inode, i_size_read(inode), start_pos); | ||
1080 | if (err) | ||
1081 | return err; | ||
1082 | } | ||
1083 | |||
1084 | again: | 1080 | again: |
1085 | for (i = 0; i < num_pages; i++) { | 1081 | for (i = 0; i < num_pages; i++) { |
1086 | pages[i] = find_or_create_page(inode->i_mapping, index + i, | 1082 | pages[i] = find_or_create_page(inode->i_mapping, index + i, |
@@ -1092,10 +1088,11 @@ again: | |||
1092 | } | 1088 | } |
1093 | 1089 | ||
1094 | if (i == 0) | 1090 | if (i == 0) |
1095 | err = prepare_uptodate_page(pages[i], pos); | 1091 | err = prepare_uptodate_page(pages[i], pos, |
1092 | force_uptodate); | ||
1096 | if (i == num_pages - 1) | 1093 | if (i == num_pages - 1) |
1097 | err = prepare_uptodate_page(pages[i], | 1094 | err = prepare_uptodate_page(pages[i], |
1098 | pos + write_bytes); | 1095 | pos + write_bytes, false); |
1099 | if (err) { | 1096 | if (err) { |
1100 | page_cache_release(pages[i]); | 1097 | page_cache_release(pages[i]); |
1101 | faili = i - 1; | 1098 | faili = i - 1; |
@@ -1164,6 +1161,7 @@ static noinline ssize_t __btrfs_buffered_write(struct file *file, | |||
1164 | size_t num_written = 0; | 1161 | size_t num_written = 0; |
1165 | int nrptrs; | 1162 | int nrptrs; |
1166 | int ret = 0; | 1163 | int ret = 0; |
1164 | bool force_page_uptodate = false; | ||
1167 | 1165 | ||
1168 | nrptrs = min((iov_iter_count(i) + PAGE_CACHE_SIZE - 1) / | 1166 | nrptrs = min((iov_iter_count(i) + PAGE_CACHE_SIZE - 1) / |
1169 | PAGE_CACHE_SIZE, PAGE_CACHE_SIZE / | 1167 | PAGE_CACHE_SIZE, PAGE_CACHE_SIZE / |
@@ -1206,7 +1204,8 @@ static noinline ssize_t __btrfs_buffered_write(struct file *file, | |||
1206 | * contents of pages from loop to loop | 1204 | * contents of pages from loop to loop |
1207 | */ | 1205 | */ |
1208 | ret = prepare_pages(root, file, pages, num_pages, | 1206 | ret = prepare_pages(root, file, pages, num_pages, |
1209 | pos, first_index, write_bytes); | 1207 | pos, first_index, write_bytes, |
1208 | force_page_uptodate); | ||
1210 | if (ret) { | 1209 | if (ret) { |
1211 | btrfs_delalloc_release_space(inode, | 1210 | btrfs_delalloc_release_space(inode, |
1212 | num_pages << PAGE_CACHE_SHIFT); | 1211 | num_pages << PAGE_CACHE_SHIFT); |
@@ -1223,12 +1222,15 @@ static noinline ssize_t __btrfs_buffered_write(struct file *file, | |||
1223 | if (copied < write_bytes) | 1222 | if (copied < write_bytes) |
1224 | nrptrs = 1; | 1223 | nrptrs = 1; |
1225 | 1224 | ||
1226 | if (copied == 0) | 1225 | if (copied == 0) { |
1226 | force_page_uptodate = true; | ||
1227 | dirty_pages = 0; | 1227 | dirty_pages = 0; |
1228 | else | 1228 | } else { |
1229 | force_page_uptodate = false; | ||
1229 | dirty_pages = (copied + offset + | 1230 | dirty_pages = (copied + offset + |
1230 | PAGE_CACHE_SIZE - 1) >> | 1231 | PAGE_CACHE_SIZE - 1) >> |
1231 | PAGE_CACHE_SHIFT; | 1232 | PAGE_CACHE_SHIFT; |
1233 | } | ||
1232 | 1234 | ||
1233 | /* | 1235 | /* |
1234 | * If we had a short copy we need to release the excess delaloc | 1236 | * If we had a short copy we need to release the excess delaloc |
@@ -1338,6 +1340,7 @@ static ssize_t btrfs_file_aio_write(struct kiocb *iocb, | |||
1338 | struct inode *inode = fdentry(file)->d_inode; | 1340 | struct inode *inode = fdentry(file)->d_inode; |
1339 | struct btrfs_root *root = BTRFS_I(inode)->root; | 1341 | struct btrfs_root *root = BTRFS_I(inode)->root; |
1340 | loff_t *ppos = &iocb->ki_pos; | 1342 | loff_t *ppos = &iocb->ki_pos; |
1343 | u64 start_pos; | ||
1341 | ssize_t num_written = 0; | 1344 | ssize_t num_written = 0; |
1342 | ssize_t err = 0; | 1345 | ssize_t err = 0; |
1343 | size_t count, ocount; | 1346 | size_t count, ocount; |
@@ -1386,6 +1389,15 @@ static ssize_t btrfs_file_aio_write(struct kiocb *iocb, | |||
1386 | file_update_time(file); | 1389 | file_update_time(file); |
1387 | BTRFS_I(inode)->sequence++; | 1390 | BTRFS_I(inode)->sequence++; |
1388 | 1391 | ||
1392 | start_pos = round_down(pos, root->sectorsize); | ||
1393 | if (start_pos > i_size_read(inode)) { | ||
1394 | err = btrfs_cont_expand(inode, i_size_read(inode), start_pos); | ||
1395 | if (err) { | ||
1396 | mutex_unlock(&inode->i_mutex); | ||
1397 | goto out; | ||
1398 | } | ||
1399 | } | ||
1400 | |||
1389 | if (unlikely(file->f_flags & O_DIRECT)) { | 1401 | if (unlikely(file->f_flags & O_DIRECT)) { |
1390 | num_written = __btrfs_direct_write(iocb, iov, nr_segs, | 1402 | num_written = __btrfs_direct_write(iocb, iov, nr_segs, |
1391 | pos, ppos, count, ocount); | 1403 | pos, ppos, count, ocount); |
@@ -1813,6 +1825,11 @@ static loff_t btrfs_file_llseek(struct file *file, loff_t offset, int origin) | |||
1813 | goto out; | 1825 | goto out; |
1814 | case SEEK_DATA: | 1826 | case SEEK_DATA: |
1815 | case SEEK_HOLE: | 1827 | case SEEK_HOLE: |
1828 | if (offset >= i_size_read(inode)) { | ||
1829 | mutex_unlock(&inode->i_mutex); | ||
1830 | return -ENXIO; | ||
1831 | } | ||
1832 | |||
1816 | ret = find_desired_extent(inode, &offset, origin); | 1833 | ret = find_desired_extent(inode, &offset, origin); |
1817 | if (ret) { | 1834 | if (ret) { |
1818 | mutex_unlock(&inode->i_mutex); | 1835 | mutex_unlock(&inode->i_mutex); |
@@ -1821,11 +1838,11 @@ static loff_t btrfs_file_llseek(struct file *file, loff_t offset, int origin) | |||
1821 | } | 1838 | } |
1822 | 1839 | ||
1823 | if (offset < 0 && !(file->f_mode & FMODE_UNSIGNED_OFFSET)) { | 1840 | if (offset < 0 && !(file->f_mode & FMODE_UNSIGNED_OFFSET)) { |
1824 | ret = -EINVAL; | 1841 | offset = -EINVAL; |
1825 | goto out; | 1842 | goto out; |
1826 | } | 1843 | } |
1827 | if (offset > inode->i_sb->s_maxbytes) { | 1844 | if (offset > inode->i_sb->s_maxbytes) { |
1828 | ret = -EINVAL; | 1845 | offset = -EINVAL; |
1829 | goto out; | 1846 | goto out; |
1830 | } | 1847 | } |
1831 | 1848 | ||
diff --git a/fs/btrfs/free-space-cache.c b/fs/btrfs/free-space-cache.c index 6a265b9f85f2..41ac927401d0 100644 --- a/fs/btrfs/free-space-cache.c +++ b/fs/btrfs/free-space-cache.c | |||
@@ -190,9 +190,11 @@ int btrfs_truncate_free_space_cache(struct btrfs_root *root, | |||
190 | struct btrfs_path *path, | 190 | struct btrfs_path *path, |
191 | struct inode *inode) | 191 | struct inode *inode) |
192 | { | 192 | { |
193 | struct btrfs_block_rsv *rsv; | ||
193 | loff_t oldsize; | 194 | loff_t oldsize; |
194 | int ret = 0; | 195 | int ret = 0; |
195 | 196 | ||
197 | rsv = trans->block_rsv; | ||
196 | trans->block_rsv = root->orphan_block_rsv; | 198 | trans->block_rsv = root->orphan_block_rsv; |
197 | ret = btrfs_block_rsv_check(trans, root, | 199 | ret = btrfs_block_rsv_check(trans, root, |
198 | root->orphan_block_rsv, | 200 | root->orphan_block_rsv, |
@@ -210,6 +212,8 @@ int btrfs_truncate_free_space_cache(struct btrfs_root *root, | |||
210 | */ | 212 | */ |
211 | ret = btrfs_truncate_inode_items(trans, root, inode, | 213 | ret = btrfs_truncate_inode_items(trans, root, inode, |
212 | 0, BTRFS_EXTENT_DATA_KEY); | 214 | 0, BTRFS_EXTENT_DATA_KEY); |
215 | |||
216 | trans->block_rsv = rsv; | ||
213 | if (ret) { | 217 | if (ret) { |
214 | WARN_ON(1); | 218 | WARN_ON(1); |
215 | return ret; | 219 | return ret; |
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index 0ccc7438ad34..b2d004ad66a0 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c | |||
@@ -1786,7 +1786,7 @@ static int btrfs_finish_ordered_io(struct inode *inode, u64 start, u64 end) | |||
1786 | &ordered_extent->list); | 1786 | &ordered_extent->list); |
1787 | 1787 | ||
1788 | ret = btrfs_ordered_update_i_size(inode, 0, ordered_extent); | 1788 | ret = btrfs_ordered_update_i_size(inode, 0, ordered_extent); |
1789 | if (!ret) { | 1789 | if (!ret || !test_bit(BTRFS_ORDERED_PREALLOC, &ordered_extent->flags)) { |
1790 | ret = btrfs_update_inode(trans, root, inode); | 1790 | ret = btrfs_update_inode(trans, root, inode); |
1791 | BUG_ON(ret); | 1791 | BUG_ON(ret); |
1792 | } | 1792 | } |
@@ -3510,15 +3510,19 @@ int btrfs_cont_expand(struct inode *inode, loff_t oldsize, loff_t size) | |||
3510 | err = btrfs_drop_extents(trans, inode, cur_offset, | 3510 | err = btrfs_drop_extents(trans, inode, cur_offset, |
3511 | cur_offset + hole_size, | 3511 | cur_offset + hole_size, |
3512 | &hint_byte, 1); | 3512 | &hint_byte, 1); |
3513 | if (err) | 3513 | if (err) { |
3514 | btrfs_end_transaction(trans, root); | ||
3514 | break; | 3515 | break; |
3516 | } | ||
3515 | 3517 | ||
3516 | err = btrfs_insert_file_extent(trans, root, | 3518 | err = btrfs_insert_file_extent(trans, root, |
3517 | btrfs_ino(inode), cur_offset, 0, | 3519 | btrfs_ino(inode), cur_offset, 0, |
3518 | 0, hole_size, 0, hole_size, | 3520 | 0, hole_size, 0, hole_size, |
3519 | 0, 0, 0); | 3521 | 0, 0, 0); |
3520 | if (err) | 3522 | if (err) { |
3523 | btrfs_end_transaction(trans, root); | ||
3521 | break; | 3524 | break; |
3525 | } | ||
3522 | 3526 | ||
3523 | btrfs_drop_extent_cache(inode, hole_start, | 3527 | btrfs_drop_extent_cache(inode, hole_start, |
3524 | last_byte - 1, 0); | 3528 | last_byte - 1, 0); |
@@ -3952,7 +3956,6 @@ struct inode *btrfs_iget(struct super_block *s, struct btrfs_key *location, | |||
3952 | struct btrfs_root *root, int *new) | 3956 | struct btrfs_root *root, int *new) |
3953 | { | 3957 | { |
3954 | struct inode *inode; | 3958 | struct inode *inode; |
3955 | int bad_inode = 0; | ||
3956 | 3959 | ||
3957 | inode = btrfs_iget_locked(s, location->objectid, root); | 3960 | inode = btrfs_iget_locked(s, location->objectid, root); |
3958 | if (!inode) | 3961 | if (!inode) |
@@ -3968,15 +3971,12 @@ struct inode *btrfs_iget(struct super_block *s, struct btrfs_key *location, | |||
3968 | if (new) | 3971 | if (new) |
3969 | *new = 1; | 3972 | *new = 1; |
3970 | } else { | 3973 | } else { |
3971 | bad_inode = 1; | 3974 | unlock_new_inode(inode); |
3975 | iput(inode); | ||
3976 | inode = ERR_PTR(-ESTALE); | ||
3972 | } | 3977 | } |
3973 | } | 3978 | } |
3974 | 3979 | ||
3975 | if (bad_inode) { | ||
3976 | iput(inode); | ||
3977 | inode = ERR_PTR(-ESTALE); | ||
3978 | } | ||
3979 | |||
3980 | return inode; | 3980 | return inode; |
3981 | } | 3981 | } |
3982 | 3982 | ||
@@ -4018,7 +4018,8 @@ struct inode *btrfs_lookup_dentry(struct inode *dir, struct dentry *dentry) | |||
4018 | memcpy(&location, dentry->d_fsdata, sizeof(struct btrfs_key)); | 4018 | memcpy(&location, dentry->d_fsdata, sizeof(struct btrfs_key)); |
4019 | kfree(dentry->d_fsdata); | 4019 | kfree(dentry->d_fsdata); |
4020 | dentry->d_fsdata = NULL; | 4020 | dentry->d_fsdata = NULL; |
4021 | d_clear_need_lookup(dentry); | 4021 | /* This thing is hashed, drop it for now */ |
4022 | d_drop(dentry); | ||
4022 | } else { | 4023 | } else { |
4023 | ret = btrfs_inode_by_name(dir, dentry, &location); | 4024 | ret = btrfs_inode_by_name(dir, dentry, &location); |
4024 | } | 4025 | } |
@@ -4085,7 +4086,15 @@ static void btrfs_dentry_release(struct dentry *dentry) | |||
4085 | static struct dentry *btrfs_lookup(struct inode *dir, struct dentry *dentry, | 4086 | static struct dentry *btrfs_lookup(struct inode *dir, struct dentry *dentry, |
4086 | struct nameidata *nd) | 4087 | struct nameidata *nd) |
4087 | { | 4088 | { |
4088 | return d_splice_alias(btrfs_lookup_dentry(dir, dentry), dentry); | 4089 | struct dentry *ret; |
4090 | |||
4091 | ret = d_splice_alias(btrfs_lookup_dentry(dir, dentry), dentry); | ||
4092 | if (unlikely(d_need_lookup(dentry))) { | ||
4093 | spin_lock(&dentry->d_lock); | ||
4094 | dentry->d_flags &= ~DCACHE_NEED_LOOKUP; | ||
4095 | spin_unlock(&dentry->d_lock); | ||
4096 | } | ||
4097 | return ret; | ||
4089 | } | 4098 | } |
4090 | 4099 | ||
4091 | unsigned char btrfs_filetype_table[] = { | 4100 | unsigned char btrfs_filetype_table[] = { |
@@ -4125,7 +4134,8 @@ static int btrfs_real_readdir(struct file *filp, void *dirent, | |||
4125 | 4134 | ||
4126 | /* special case for "." */ | 4135 | /* special case for "." */ |
4127 | if (filp->f_pos == 0) { | 4136 | if (filp->f_pos == 0) { |
4128 | over = filldir(dirent, ".", 1, 1, btrfs_ino(inode), DT_DIR); | 4137 | over = filldir(dirent, ".", 1, |
4138 | filp->f_pos, btrfs_ino(inode), DT_DIR); | ||
4129 | if (over) | 4139 | if (over) |
4130 | return 0; | 4140 | return 0; |
4131 | filp->f_pos = 1; | 4141 | filp->f_pos = 1; |
@@ -4134,7 +4144,7 @@ static int btrfs_real_readdir(struct file *filp, void *dirent, | |||
4134 | if (filp->f_pos == 1) { | 4144 | if (filp->f_pos == 1) { |
4135 | u64 pino = parent_ino(filp->f_path.dentry); | 4145 | u64 pino = parent_ino(filp->f_path.dentry); |
4136 | over = filldir(dirent, "..", 2, | 4146 | over = filldir(dirent, "..", 2, |
4137 | 2, pino, DT_DIR); | 4147 | filp->f_pos, pino, DT_DIR); |
4138 | if (over) | 4148 | if (over) |
4139 | return 0; | 4149 | return 0; |
4140 | filp->f_pos = 2; | 4150 | filp->f_pos = 2; |
@@ -5823,7 +5833,7 @@ again: | |||
5823 | 5833 | ||
5824 | add_pending_csums(trans, inode, ordered->file_offset, &ordered->list); | 5834 | add_pending_csums(trans, inode, ordered->file_offset, &ordered->list); |
5825 | ret = btrfs_ordered_update_i_size(inode, 0, ordered); | 5835 | ret = btrfs_ordered_update_i_size(inode, 0, ordered); |
5826 | if (!ret) | 5836 | if (!ret || !test_bit(BTRFS_ORDERED_PREALLOC, &ordered->flags)) |
5827 | btrfs_update_inode(trans, root, inode); | 5837 | btrfs_update_inode(trans, root, inode); |
5828 | ret = 0; | 5838 | ret = 0; |
5829 | out_unlock: | 5839 | out_unlock: |
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c index 970977aab224..538f65a79ec5 100644 --- a/fs/btrfs/ioctl.c +++ b/fs/btrfs/ioctl.c | |||
@@ -2177,6 +2177,11 @@ static noinline long btrfs_ioctl_clone(struct file *file, unsigned long srcfd, | |||
2177 | if (!(src_file->f_mode & FMODE_READ)) | 2177 | if (!(src_file->f_mode & FMODE_READ)) |
2178 | goto out_fput; | 2178 | goto out_fput; |
2179 | 2179 | ||
2180 | /* don't make the dst file partly checksummed */ | ||
2181 | if ((BTRFS_I(src)->flags & BTRFS_INODE_NODATASUM) != | ||
2182 | (BTRFS_I(inode)->flags & BTRFS_INODE_NODATASUM)) | ||
2183 | goto out_fput; | ||
2184 | |||
2180 | ret = -EISDIR; | 2185 | ret = -EISDIR; |
2181 | if (S_ISDIR(src->i_mode) || S_ISDIR(inode->i_mode)) | 2186 | if (S_ISDIR(src->i_mode) || S_ISDIR(inode->i_mode)) |
2182 | goto out_fput; | 2187 | goto out_fput; |
@@ -2220,6 +2225,16 @@ static noinline long btrfs_ioctl_clone(struct file *file, unsigned long srcfd, | |||
2220 | !IS_ALIGNED(destoff, bs)) | 2225 | !IS_ALIGNED(destoff, bs)) |
2221 | goto out_unlock; | 2226 | goto out_unlock; |
2222 | 2227 | ||
2228 | if (destoff > inode->i_size) { | ||
2229 | ret = btrfs_cont_expand(inode, inode->i_size, destoff); | ||
2230 | if (ret) | ||
2231 | goto out_unlock; | ||
2232 | } | ||
2233 | |||
2234 | /* truncate page cache pages from target inode range */ | ||
2235 | truncate_inode_pages_range(&inode->i_data, destoff, | ||
2236 | PAGE_CACHE_ALIGN(destoff + len) - 1); | ||
2237 | |||
2223 | /* do any pending delalloc/csum calc on src, one way or | 2238 | /* do any pending delalloc/csum calc on src, one way or |
2224 | another, and lock file content */ | 2239 | another, and lock file content */ |
2225 | while (1) { | 2240 | while (1) { |
@@ -2236,10 +2251,6 @@ static noinline long btrfs_ioctl_clone(struct file *file, unsigned long srcfd, | |||
2236 | btrfs_wait_ordered_range(src, off, len); | 2251 | btrfs_wait_ordered_range(src, off, len); |
2237 | } | 2252 | } |
2238 | 2253 | ||
2239 | /* truncate page cache pages from target inode range */ | ||
2240 | truncate_inode_pages_range(&inode->i_data, off, | ||
2241 | ALIGN(off + len, PAGE_CACHE_SIZE) - 1); | ||
2242 | |||
2243 | /* clone data */ | 2254 | /* clone data */ |
2244 | key.objectid = btrfs_ino(src); | 2255 | key.objectid = btrfs_ino(src); |
2245 | key.type = BTRFS_EXTENT_DATA_KEY; | 2256 | key.type = BTRFS_EXTENT_DATA_KEY; |
@@ -2317,7 +2328,12 @@ static noinline long btrfs_ioctl_clone(struct file *file, unsigned long srcfd, | |||
2317 | else | 2328 | else |
2318 | new_key.offset = destoff; | 2329 | new_key.offset = destoff; |
2319 | 2330 | ||
2320 | trans = btrfs_start_transaction(root, 1); | 2331 | /* |
2332 | * 1 - adjusting old extent (we may have to split it) | ||
2333 | * 1 - add new extent | ||
2334 | * 1 - inode update | ||
2335 | */ | ||
2336 | trans = btrfs_start_transaction(root, 3); | ||
2321 | if (IS_ERR(trans)) { | 2337 | if (IS_ERR(trans)) { |
2322 | ret = PTR_ERR(trans); | 2338 | ret = PTR_ERR(trans); |
2323 | goto out; | 2339 | goto out; |
@@ -2325,14 +2341,21 @@ static noinline long btrfs_ioctl_clone(struct file *file, unsigned long srcfd, | |||
2325 | 2341 | ||
2326 | if (type == BTRFS_FILE_EXTENT_REG || | 2342 | if (type == BTRFS_FILE_EXTENT_REG || |
2327 | type == BTRFS_FILE_EXTENT_PREALLOC) { | 2343 | type == BTRFS_FILE_EXTENT_PREALLOC) { |
2344 | /* | ||
2345 | * a | --- range to clone ---| b | ||
2346 | * | ------------- extent ------------- | | ||
2347 | */ | ||
2348 | |||
2349 | /* substract range b */ | ||
2350 | if (key.offset + datal > off + len) | ||
2351 | datal = off + len - key.offset; | ||
2352 | |||
2353 | /* substract range a */ | ||
2328 | if (off > key.offset) { | 2354 | if (off > key.offset) { |
2329 | datao += off - key.offset; | 2355 | datao += off - key.offset; |
2330 | datal -= off - key.offset; | 2356 | datal -= off - key.offset; |
2331 | } | 2357 | } |
2332 | 2358 | ||
2333 | if (key.offset + datal > off + len) | ||
2334 | datal = off + len - key.offset; | ||
2335 | |||
2336 | ret = btrfs_drop_extents(trans, inode, | 2359 | ret = btrfs_drop_extents(trans, inode, |
2337 | new_key.offset, | 2360 | new_key.offset, |
2338 | new_key.offset + datal, | 2361 | new_key.offset + datal, |
@@ -2429,7 +2452,6 @@ static noinline long btrfs_ioctl_clone(struct file *file, unsigned long srcfd, | |||
2429 | if (endoff > inode->i_size) | 2452 | if (endoff > inode->i_size) |
2430 | btrfs_i_size_write(inode, endoff); | 2453 | btrfs_i_size_write(inode, endoff); |
2431 | 2454 | ||
2432 | BTRFS_I(inode)->flags = BTRFS_I(src)->flags; | ||
2433 | ret = btrfs_update_inode(trans, root, inode); | 2455 | ret = btrfs_update_inode(trans, root, inode); |
2434 | BUG_ON(ret); | 2456 | BUG_ON(ret); |
2435 | btrfs_end_transaction(trans, root); | 2457 | btrfs_end_transaction(trans, root); |
diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c index 7dc36fab4afc..e24b7964a155 100644 --- a/fs/btrfs/transaction.c +++ b/fs/btrfs/transaction.c | |||
@@ -884,6 +884,7 @@ static noinline int create_pending_snapshot(struct btrfs_trans_handle *trans, | |||
884 | struct btrfs_root *tree_root = fs_info->tree_root; | 884 | struct btrfs_root *tree_root = fs_info->tree_root; |
885 | struct btrfs_root *root = pending->root; | 885 | struct btrfs_root *root = pending->root; |
886 | struct btrfs_root *parent_root; | 886 | struct btrfs_root *parent_root; |
887 | struct btrfs_block_rsv *rsv; | ||
887 | struct inode *parent_inode; | 888 | struct inode *parent_inode; |
888 | struct dentry *parent; | 889 | struct dentry *parent; |
889 | struct dentry *dentry; | 890 | struct dentry *dentry; |
@@ -895,6 +896,8 @@ static noinline int create_pending_snapshot(struct btrfs_trans_handle *trans, | |||
895 | u64 objectid; | 896 | u64 objectid; |
896 | u64 root_flags; | 897 | u64 root_flags; |
897 | 898 | ||
899 | rsv = trans->block_rsv; | ||
900 | |||
898 | new_root_item = kmalloc(sizeof(*new_root_item), GFP_NOFS); | 901 | new_root_item = kmalloc(sizeof(*new_root_item), GFP_NOFS); |
899 | if (!new_root_item) { | 902 | if (!new_root_item) { |
900 | pending->error = -ENOMEM; | 903 | pending->error = -ENOMEM; |
@@ -1002,6 +1005,7 @@ static noinline int create_pending_snapshot(struct btrfs_trans_handle *trans, | |||
1002 | btrfs_orphan_post_snapshot(trans, pending); | 1005 | btrfs_orphan_post_snapshot(trans, pending); |
1003 | fail: | 1006 | fail: |
1004 | kfree(new_root_item); | 1007 | kfree(new_root_item); |
1008 | trans->block_rsv = rsv; | ||
1005 | btrfs_block_rsv_release(root, &pending->block_rsv, (u64)-1); | 1009 | btrfs_block_rsv_release(root, &pending->block_rsv, (u64)-1); |
1006 | return 0; | 1010 | return 0; |
1007 | } | 1011 | } |
diff --git a/fs/btrfs/xattr.c b/fs/btrfs/xattr.c index d733b9cfea34..69565e5fc6a0 100644 --- a/fs/btrfs/xattr.c +++ b/fs/btrfs/xattr.c | |||
@@ -116,6 +116,12 @@ static int do_setxattr(struct btrfs_trans_handle *trans, | |||
116 | if (ret) | 116 | if (ret) |
117 | goto out; | 117 | goto out; |
118 | btrfs_release_path(path); | 118 | btrfs_release_path(path); |
119 | |||
120 | /* | ||
121 | * remove the attribute | ||
122 | */ | ||
123 | if (!value) | ||
124 | goto out; | ||
119 | } | 125 | } |
120 | 126 | ||
121 | again: | 127 | again: |
@@ -158,6 +164,9 @@ out: | |||
158 | return ret; | 164 | return ret; |
159 | } | 165 | } |
160 | 166 | ||
167 | /* | ||
168 | * @value: "" makes the attribute to empty, NULL removes it | ||
169 | */ | ||
161 | int __btrfs_setxattr(struct btrfs_trans_handle *trans, | 170 | int __btrfs_setxattr(struct btrfs_trans_handle *trans, |
162 | struct inode *inode, const char *name, | 171 | struct inode *inode, const char *name, |
163 | const void *value, size_t size, int flags) | 172 | const void *value, size_t size, int flags) |
diff --git a/fs/ceph/mds_client.c b/fs/ceph/mds_client.c index fee028b5332e..86c59e16ba74 100644 --- a/fs/ceph/mds_client.c +++ b/fs/ceph/mds_client.c | |||
@@ -1595,7 +1595,7 @@ static int set_request_path_attr(struct inode *rinode, struct dentry *rdentry, | |||
1595 | r = build_dentry_path(rdentry, ppath, pathlen, ino, freepath); | 1595 | r = build_dentry_path(rdentry, ppath, pathlen, ino, freepath); |
1596 | dout(" dentry %p %llx/%.*s\n", rdentry, *ino, *pathlen, | 1596 | dout(" dentry %p %llx/%.*s\n", rdentry, *ino, *pathlen, |
1597 | *ppath); | 1597 | *ppath); |
1598 | } else if (rpath) { | 1598 | } else if (rpath || rino) { |
1599 | *ino = rino; | 1599 | *ino = rino; |
1600 | *ppath = rpath; | 1600 | *ppath = rpath; |
1601 | *pathlen = strlen(rpath); | 1601 | *pathlen = strlen(rpath); |
diff --git a/fs/ceph/super.c b/fs/ceph/super.c index d47c5ec7fb1f..88bacaf385d9 100644 --- a/fs/ceph/super.c +++ b/fs/ceph/super.c | |||
@@ -813,8 +813,8 @@ static struct dentry *ceph_mount(struct file_system_type *fs_type, | |||
813 | fsc = create_fs_client(fsopt, opt); | 813 | fsc = create_fs_client(fsopt, opt); |
814 | if (IS_ERR(fsc)) { | 814 | if (IS_ERR(fsc)) { |
815 | res = ERR_CAST(fsc); | 815 | res = ERR_CAST(fsc); |
816 | kfree(fsopt); | 816 | destroy_mount_options(fsopt); |
817 | kfree(opt); | 817 | ceph_destroy_options(opt); |
818 | goto out_final; | 818 | goto out_final; |
819 | } | 819 | } |
820 | 820 | ||
diff --git a/fs/cifs/cifsencrypt.c b/fs/cifs/cifsencrypt.c index e76bfeb68267..30acd22147e1 100644 --- a/fs/cifs/cifsencrypt.c +++ b/fs/cifs/cifsencrypt.c | |||
@@ -351,9 +351,7 @@ static int | |||
351 | build_avpair_blob(struct cifs_ses *ses, const struct nls_table *nls_cp) | 351 | build_avpair_blob(struct cifs_ses *ses, const struct nls_table *nls_cp) |
352 | { | 352 | { |
353 | unsigned int dlen; | 353 | unsigned int dlen; |
354 | unsigned int wlen; | 354 | unsigned int size = 2 * sizeof(struct ntlmssp2_name); |
355 | unsigned int size = 6 * sizeof(struct ntlmssp2_name); | ||
356 | __le64 curtime; | ||
357 | char *defdmname = "WORKGROUP"; | 355 | char *defdmname = "WORKGROUP"; |
358 | unsigned char *blobptr; | 356 | unsigned char *blobptr; |
359 | struct ntlmssp2_name *attrptr; | 357 | struct ntlmssp2_name *attrptr; |
@@ -365,15 +363,14 @@ build_avpair_blob(struct cifs_ses *ses, const struct nls_table *nls_cp) | |||
365 | } | 363 | } |
366 | 364 | ||
367 | dlen = strlen(ses->domainName); | 365 | dlen = strlen(ses->domainName); |
368 | wlen = strlen(ses->server->hostname); | ||
369 | 366 | ||
370 | /* The length of this blob is a size which is | 367 | /* |
371 | * six times the size of a structure which holds name/size + | 368 | * The length of this blob is two times the size of a |
372 | * two times the unicode length of a domain name + | 369 | * structure (av pair) which holds name/size |
373 | * two times the unicode length of a server name + | 370 | * ( for NTLMSSP_AV_NB_DOMAIN_NAME followed by NTLMSSP_AV_EOL ) + |
374 | * size of a timestamp (which is 8 bytes). | 371 | * unicode length of a netbios domain name |
375 | */ | 372 | */ |
376 | ses->auth_key.len = size + 2 * (2 * dlen) + 2 * (2 * wlen) + 8; | 373 | ses->auth_key.len = size + 2 * dlen; |
377 | ses->auth_key.response = kzalloc(ses->auth_key.len, GFP_KERNEL); | 374 | ses->auth_key.response = kzalloc(ses->auth_key.len, GFP_KERNEL); |
378 | if (!ses->auth_key.response) { | 375 | if (!ses->auth_key.response) { |
379 | ses->auth_key.len = 0; | 376 | ses->auth_key.len = 0; |
@@ -384,44 +381,15 @@ build_avpair_blob(struct cifs_ses *ses, const struct nls_table *nls_cp) | |||
384 | blobptr = ses->auth_key.response; | 381 | blobptr = ses->auth_key.response; |
385 | attrptr = (struct ntlmssp2_name *) blobptr; | 382 | attrptr = (struct ntlmssp2_name *) blobptr; |
386 | 383 | ||
384 | /* | ||
385 | * As defined in MS-NTLM 3.3.2, just this av pair field | ||
386 | * is sufficient as part of the temp | ||
387 | */ | ||
387 | attrptr->type = cpu_to_le16(NTLMSSP_AV_NB_DOMAIN_NAME); | 388 | attrptr->type = cpu_to_le16(NTLMSSP_AV_NB_DOMAIN_NAME); |
388 | attrptr->length = cpu_to_le16(2 * dlen); | 389 | attrptr->length = cpu_to_le16(2 * dlen); |
389 | blobptr = (unsigned char *)attrptr + sizeof(struct ntlmssp2_name); | 390 | blobptr = (unsigned char *)attrptr + sizeof(struct ntlmssp2_name); |
390 | cifs_strtoUCS((__le16 *)blobptr, ses->domainName, dlen, nls_cp); | 391 | cifs_strtoUCS((__le16 *)blobptr, ses->domainName, dlen, nls_cp); |
391 | 392 | ||
392 | blobptr += 2 * dlen; | ||
393 | attrptr = (struct ntlmssp2_name *) blobptr; | ||
394 | |||
395 | attrptr->type = cpu_to_le16(NTLMSSP_AV_NB_COMPUTER_NAME); | ||
396 | attrptr->length = cpu_to_le16(2 * wlen); | ||
397 | blobptr = (unsigned char *)attrptr + sizeof(struct ntlmssp2_name); | ||
398 | cifs_strtoUCS((__le16 *)blobptr, ses->server->hostname, wlen, nls_cp); | ||
399 | |||
400 | blobptr += 2 * wlen; | ||
401 | attrptr = (struct ntlmssp2_name *) blobptr; | ||
402 | |||
403 | attrptr->type = cpu_to_le16(NTLMSSP_AV_DNS_DOMAIN_NAME); | ||
404 | attrptr->length = cpu_to_le16(2 * dlen); | ||
405 | blobptr = (unsigned char *)attrptr + sizeof(struct ntlmssp2_name); | ||
406 | cifs_strtoUCS((__le16 *)blobptr, ses->domainName, dlen, nls_cp); | ||
407 | |||
408 | blobptr += 2 * dlen; | ||
409 | attrptr = (struct ntlmssp2_name *) blobptr; | ||
410 | |||
411 | attrptr->type = cpu_to_le16(NTLMSSP_AV_DNS_COMPUTER_NAME); | ||
412 | attrptr->length = cpu_to_le16(2 * wlen); | ||
413 | blobptr = (unsigned char *)attrptr + sizeof(struct ntlmssp2_name); | ||
414 | cifs_strtoUCS((__le16 *)blobptr, ses->server->hostname, wlen, nls_cp); | ||
415 | |||
416 | blobptr += 2 * wlen; | ||
417 | attrptr = (struct ntlmssp2_name *) blobptr; | ||
418 | |||
419 | attrptr->type = cpu_to_le16(NTLMSSP_AV_TIMESTAMP); | ||
420 | attrptr->length = cpu_to_le16(sizeof(__le64)); | ||
421 | blobptr = (unsigned char *)attrptr + sizeof(struct ntlmssp2_name); | ||
422 | curtime = cpu_to_le64(cifs_UnixTimeToNT(CURRENT_TIME)); | ||
423 | memcpy(blobptr, &curtime, sizeof(__le64)); | ||
424 | |||
425 | return 0; | 393 | return 0; |
426 | } | 394 | } |
427 | 395 | ||
diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c index f93eb948d071..54b8f1e7da94 100644 --- a/fs/cifs/cifsfs.c +++ b/fs/cifs/cifsfs.c | |||
@@ -548,6 +548,12 @@ cifs_get_root(struct smb_vol *vol, struct super_block *sb) | |||
548 | struct inode *dir = dentry->d_inode; | 548 | struct inode *dir = dentry->d_inode; |
549 | struct dentry *child; | 549 | struct dentry *child; |
550 | 550 | ||
551 | if (!dir) { | ||
552 | dput(dentry); | ||
553 | dentry = ERR_PTR(-ENOENT); | ||
554 | break; | ||
555 | } | ||
556 | |||
551 | /* skip separators */ | 557 | /* skip separators */ |
552 | while (*s == sep) | 558 | while (*s == sep) |
553 | s++; | 559 | s++; |
@@ -563,10 +569,6 @@ cifs_get_root(struct smb_vol *vol, struct super_block *sb) | |||
563 | mutex_unlock(&dir->i_mutex); | 569 | mutex_unlock(&dir->i_mutex); |
564 | dput(dentry); | 570 | dput(dentry); |
565 | dentry = child; | 571 | dentry = child; |
566 | if (!dentry->d_inode) { | ||
567 | dput(dentry); | ||
568 | dentry = ERR_PTR(-ENOENT); | ||
569 | } | ||
570 | } while (!IS_ERR(dentry)); | 572 | } while (!IS_ERR(dentry)); |
571 | _FreeXid(xid); | 573 | _FreeXid(xid); |
572 | kfree(full_path); | 574 | kfree(full_path); |
diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c index aac37d99a487..a80f7bd97b90 100644 --- a/fs/cifs/cifssmb.c +++ b/fs/cifs/cifssmb.c | |||
@@ -4079,7 +4079,8 @@ int CIFSFindNext(const int xid, struct cifs_tcon *tcon, | |||
4079 | T2_FNEXT_RSP_PARMS *parms; | 4079 | T2_FNEXT_RSP_PARMS *parms; |
4080 | char *response_data; | 4080 | char *response_data; |
4081 | int rc = 0; | 4081 | int rc = 0; |
4082 | int bytes_returned, name_len; | 4082 | int bytes_returned; |
4083 | unsigned int name_len; | ||
4083 | __u16 params, byte_count; | 4084 | __u16 params, byte_count; |
4084 | 4085 | ||
4085 | cFYI(1, "In FindNext"); | 4086 | cFYI(1, "In FindNext"); |
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c index 633c246b6775..f4af4cc37500 100644 --- a/fs/cifs/connect.c +++ b/fs/cifs/connect.c | |||
@@ -1298,7 +1298,7 @@ cifs_parse_mount_options(const char *mountdata, const char *devname, | |||
1298 | /* ignore */ | 1298 | /* ignore */ |
1299 | } else if (strnicmp(data, "guest", 5) == 0) { | 1299 | } else if (strnicmp(data, "guest", 5) == 0) { |
1300 | /* ignore */ | 1300 | /* ignore */ |
1301 | } else if (strnicmp(data, "rw", 2) == 0) { | 1301 | } else if (strnicmp(data, "rw", 2) == 0 && strlen(data) == 2) { |
1302 | /* ignore */ | 1302 | /* ignore */ |
1303 | } else if (strnicmp(data, "ro", 2) == 0) { | 1303 | } else if (strnicmp(data, "ro", 2) == 0) { |
1304 | /* ignore */ | 1304 | /* ignore */ |
@@ -1401,7 +1401,7 @@ cifs_parse_mount_options(const char *mountdata, const char *devname, | |||
1401 | vol->server_ino = 1; | 1401 | vol->server_ino = 1; |
1402 | } else if (strnicmp(data, "noserverino", 9) == 0) { | 1402 | } else if (strnicmp(data, "noserverino", 9) == 0) { |
1403 | vol->server_ino = 0; | 1403 | vol->server_ino = 0; |
1404 | } else if (strnicmp(data, "rwpidforward", 4) == 0) { | 1404 | } else if (strnicmp(data, "rwpidforward", 12) == 0) { |
1405 | vol->rwpidforward = 1; | 1405 | vol->rwpidforward = 1; |
1406 | } else if (strnicmp(data, "cifsacl", 7) == 0) { | 1406 | } else if (strnicmp(data, "cifsacl", 7) == 0) { |
1407 | vol->cifs_acl = 1; | 1407 | vol->cifs_acl = 1; |
diff --git a/fs/compat.c b/fs/compat.c index 0b48d018e38a..58b1da459893 100644 --- a/fs/compat.c +++ b/fs/compat.c | |||
@@ -1675,11 +1675,6 @@ asmlinkage long compat_sys_ppoll(struct pollfd __user *ufds, | |||
1675 | } | 1675 | } |
1676 | #endif /* HAVE_SET_RESTORE_SIGMASK */ | 1676 | #endif /* HAVE_SET_RESTORE_SIGMASK */ |
1677 | 1677 | ||
1678 | long asmlinkage compat_sys_nfsservctl(int cmd, void *notused, void *notused2) | ||
1679 | { | ||
1680 | return sys_ni_syscall(); | ||
1681 | } | ||
1682 | |||
1683 | #ifdef CONFIG_EPOLL | 1678 | #ifdef CONFIG_EPOLL |
1684 | 1679 | ||
1685 | #ifdef HAVE_SET_RESTORE_SIGMASK | 1680 | #ifdef HAVE_SET_RESTORE_SIGMASK |
diff --git a/fs/ext3/inode.c b/fs/ext3/inode.c index 04da6acde85d..12661e1deedd 100644 --- a/fs/ext3/inode.c +++ b/fs/ext3/inode.c | |||
@@ -1134,7 +1134,7 @@ struct buffer_head *ext3_bread(handle_t *handle, struct inode *inode, | |||
1134 | return bh; | 1134 | return bh; |
1135 | if (buffer_uptodate(bh)) | 1135 | if (buffer_uptodate(bh)) |
1136 | return bh; | 1136 | return bh; |
1137 | ll_rw_block(READ_META, 1, &bh); | 1137 | ll_rw_block(READ | REQ_META | REQ_PRIO, 1, &bh); |
1138 | wait_on_buffer(bh); | 1138 | wait_on_buffer(bh); |
1139 | if (buffer_uptodate(bh)) | 1139 | if (buffer_uptodate(bh)) |
1140 | return bh; | 1140 | return bh; |
@@ -2807,7 +2807,7 @@ make_io: | |||
2807 | trace_ext3_load_inode(inode); | 2807 | trace_ext3_load_inode(inode); |
2808 | get_bh(bh); | 2808 | get_bh(bh); |
2809 | bh->b_end_io = end_buffer_read_sync; | 2809 | bh->b_end_io = end_buffer_read_sync; |
2810 | submit_bh(READ_META, bh); | 2810 | submit_bh(READ | REQ_META | REQ_PRIO, bh); |
2811 | wait_on_buffer(bh); | 2811 | wait_on_buffer(bh); |
2812 | if (!buffer_uptodate(bh)) { | 2812 | if (!buffer_uptodate(bh)) { |
2813 | ext3_error(inode->i_sb, "ext3_get_inode_loc", | 2813 | ext3_error(inode->i_sb, "ext3_get_inode_loc", |
diff --git a/fs/ext3/namei.c b/fs/ext3/namei.c index 5571708b6a58..0629e09f6511 100644 --- a/fs/ext3/namei.c +++ b/fs/ext3/namei.c | |||
@@ -922,7 +922,8 @@ restart: | |||
922 | bh = ext3_getblk(NULL, dir, b++, 0, &err); | 922 | bh = ext3_getblk(NULL, dir, b++, 0, &err); |
923 | bh_use[ra_max] = bh; | 923 | bh_use[ra_max] = bh; |
924 | if (bh) | 924 | if (bh) |
925 | ll_rw_block(READ_META, 1, &bh); | 925 | ll_rw_block(READ | REQ_META | REQ_PRIO, |
926 | 1, &bh); | ||
926 | } | 927 | } |
927 | } | 928 | } |
928 | if ((bh = bh_use[ra_ptr++]) == NULL) | 929 | if ((bh = bh_use[ra_ptr++]) == NULL) |
diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h index e717dfd2f2b4..b7d7bd0f066e 100644 --- a/fs/ext4/ext4.h +++ b/fs/ext4/ext4.h | |||
@@ -175,6 +175,7 @@ struct mpage_da_data { | |||
175 | */ | 175 | */ |
176 | #define EXT4_IO_END_UNWRITTEN 0x0001 | 176 | #define EXT4_IO_END_UNWRITTEN 0x0001 |
177 | #define EXT4_IO_END_ERROR 0x0002 | 177 | #define EXT4_IO_END_ERROR 0x0002 |
178 | #define EXT4_IO_END_QUEUED 0x0004 | ||
178 | 179 | ||
179 | struct ext4_io_page { | 180 | struct ext4_io_page { |
180 | struct page *p_page; | 181 | struct page *p_page; |
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index c4da98a959ae..986e2388f031 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c | |||
@@ -121,9 +121,6 @@ void ext4_evict_inode(struct inode *inode) | |||
121 | 121 | ||
122 | trace_ext4_evict_inode(inode); | 122 | trace_ext4_evict_inode(inode); |
123 | 123 | ||
124 | mutex_lock(&inode->i_mutex); | ||
125 | ext4_flush_completed_IO(inode); | ||
126 | mutex_unlock(&inode->i_mutex); | ||
127 | ext4_ioend_wait(inode); | 124 | ext4_ioend_wait(inode); |
128 | 125 | ||
129 | if (inode->i_nlink) { | 126 | if (inode->i_nlink) { |
@@ -650,7 +647,7 @@ struct buffer_head *ext4_bread(handle_t *handle, struct inode *inode, | |||
650 | return bh; | 647 | return bh; |
651 | if (buffer_uptodate(bh)) | 648 | if (buffer_uptodate(bh)) |
652 | return bh; | 649 | return bh; |
653 | ll_rw_block(READ_META, 1, &bh); | 650 | ll_rw_block(READ | REQ_META | REQ_PRIO, 1, &bh); |
654 | wait_on_buffer(bh); | 651 | wait_on_buffer(bh); |
655 | if (buffer_uptodate(bh)) | 652 | if (buffer_uptodate(bh)) |
656 | return bh; | 653 | return bh; |
@@ -3301,7 +3298,7 @@ make_io: | |||
3301 | trace_ext4_load_inode(inode); | 3298 | trace_ext4_load_inode(inode); |
3302 | get_bh(bh); | 3299 | get_bh(bh); |
3303 | bh->b_end_io = end_buffer_read_sync; | 3300 | bh->b_end_io = end_buffer_read_sync; |
3304 | submit_bh(READ_META, bh); | 3301 | submit_bh(READ | REQ_META | REQ_PRIO, bh); |
3305 | wait_on_buffer(bh); | 3302 | wait_on_buffer(bh); |
3306 | if (!buffer_uptodate(bh)) { | 3303 | if (!buffer_uptodate(bh)) { |
3307 | EXT4_ERROR_INODE_BLOCK(inode, block, | 3304 | EXT4_ERROR_INODE_BLOCK(inode, block, |
diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c index f8068c7bae9f..1c924faeb6c8 100644 --- a/fs/ext4/namei.c +++ b/fs/ext4/namei.c | |||
@@ -922,7 +922,8 @@ restart: | |||
922 | bh = ext4_getblk(NULL, dir, b++, 0, &err); | 922 | bh = ext4_getblk(NULL, dir, b++, 0, &err); |
923 | bh_use[ra_max] = bh; | 923 | bh_use[ra_max] = bh; |
924 | if (bh) | 924 | if (bh) |
925 | ll_rw_block(READ_META, 1, &bh); | 925 | ll_rw_block(READ | REQ_META | REQ_PRIO, |
926 | 1, &bh); | ||
926 | } | 927 | } |
927 | } | 928 | } |
928 | if ((bh = bh_use[ra_ptr++]) == NULL) | 929 | if ((bh = bh_use[ra_ptr++]) == NULL) |
diff --git a/fs/ext4/page-io.c b/fs/ext4/page-io.c index 78839af7ce29..92f38ee13f8a 100644 --- a/fs/ext4/page-io.c +++ b/fs/ext4/page-io.c | |||
@@ -142,7 +142,23 @@ static void ext4_end_io_work(struct work_struct *work) | |||
142 | unsigned long flags; | 142 | unsigned long flags; |
143 | int ret; | 143 | int ret; |
144 | 144 | ||
145 | mutex_lock(&inode->i_mutex); | 145 | if (!mutex_trylock(&inode->i_mutex)) { |
146 | /* | ||
147 | * Requeue the work instead of waiting so that the work | ||
148 | * items queued after this can be processed. | ||
149 | */ | ||
150 | queue_work(EXT4_SB(inode->i_sb)->dio_unwritten_wq, &io->work); | ||
151 | /* | ||
152 | * To prevent the ext4-dio-unwritten thread from keeping | ||
153 | * requeueing end_io requests and occupying cpu for too long, | ||
154 | * yield the cpu if it sees an end_io request that has already | ||
155 | * been requeued. | ||
156 | */ | ||
157 | if (io->flag & EXT4_IO_END_QUEUED) | ||
158 | yield(); | ||
159 | io->flag |= EXT4_IO_END_QUEUED; | ||
160 | return; | ||
161 | } | ||
146 | ret = ext4_end_io_nolock(io); | 162 | ret = ext4_end_io_nolock(io); |
147 | if (ret < 0) { | 163 | if (ret < 0) { |
148 | mutex_unlock(&inode->i_mutex); | 164 | mutex_unlock(&inode->i_mutex); |
diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c index 640fc229df10..5cb8614508c3 100644 --- a/fs/fuse/dev.c +++ b/fs/fuse/dev.c | |||
@@ -258,10 +258,14 @@ void fuse_queue_forget(struct fuse_conn *fc, struct fuse_forget_link *forget, | |||
258 | forget->forget_one.nlookup = nlookup; | 258 | forget->forget_one.nlookup = nlookup; |
259 | 259 | ||
260 | spin_lock(&fc->lock); | 260 | spin_lock(&fc->lock); |
261 | fc->forget_list_tail->next = forget; | 261 | if (fc->connected) { |
262 | fc->forget_list_tail = forget; | 262 | fc->forget_list_tail->next = forget; |
263 | wake_up(&fc->waitq); | 263 | fc->forget_list_tail = forget; |
264 | kill_fasync(&fc->fasync, SIGIO, POLL_IN); | 264 | wake_up(&fc->waitq); |
265 | kill_fasync(&fc->fasync, SIGIO, POLL_IN); | ||
266 | } else { | ||
267 | kfree(forget); | ||
268 | } | ||
265 | spin_unlock(&fc->lock); | 269 | spin_unlock(&fc->lock); |
266 | } | 270 | } |
267 | 271 | ||
@@ -1358,6 +1362,10 @@ static int fuse_notify_inval_entry(struct fuse_conn *fc, unsigned int size, | |||
1358 | if (outarg.namelen > FUSE_NAME_MAX) | 1362 | if (outarg.namelen > FUSE_NAME_MAX) |
1359 | goto err; | 1363 | goto err; |
1360 | 1364 | ||
1365 | err = -EINVAL; | ||
1366 | if (size != sizeof(outarg) + outarg.namelen + 1) | ||
1367 | goto err; | ||
1368 | |||
1361 | name.name = buf; | 1369 | name.name = buf; |
1362 | name.len = outarg.namelen; | 1370 | name.len = outarg.namelen; |
1363 | err = fuse_copy_one(cs, buf, outarg.namelen + 1); | 1371 | err = fuse_copy_one(cs, buf, outarg.namelen + 1); |
diff --git a/fs/fuse/file.c b/fs/fuse/file.c index d480d9af46c9..594f07a81c28 100644 --- a/fs/fuse/file.c +++ b/fs/fuse/file.c | |||
@@ -14,6 +14,7 @@ | |||
14 | #include <linux/sched.h> | 14 | #include <linux/sched.h> |
15 | #include <linux/module.h> | 15 | #include <linux/module.h> |
16 | #include <linux/compat.h> | 16 | #include <linux/compat.h> |
17 | #include <linux/swap.h> | ||
17 | 18 | ||
18 | static const struct file_operations fuse_direct_io_file_operations; | 19 | static const struct file_operations fuse_direct_io_file_operations; |
19 | 20 | ||
@@ -245,6 +246,12 @@ void fuse_release_common(struct file *file, int opcode) | |||
245 | req = ff->reserved_req; | 246 | req = ff->reserved_req; |
246 | fuse_prepare_release(ff, file->f_flags, opcode); | 247 | fuse_prepare_release(ff, file->f_flags, opcode); |
247 | 248 | ||
249 | if (ff->flock) { | ||
250 | struct fuse_release_in *inarg = &req->misc.release.in; | ||
251 | inarg->release_flags |= FUSE_RELEASE_FLOCK_UNLOCK; | ||
252 | inarg->lock_owner = fuse_lock_owner_id(ff->fc, | ||
253 | (fl_owner_t) file); | ||
254 | } | ||
248 | /* Hold vfsmount and dentry until release is finished */ | 255 | /* Hold vfsmount and dentry until release is finished */ |
249 | path_get(&file->f_path); | 256 | path_get(&file->f_path); |
250 | req->misc.release.path = file->f_path; | 257 | req->misc.release.path = file->f_path; |
@@ -755,18 +762,6 @@ static size_t fuse_send_write(struct fuse_req *req, struct file *file, | |||
755 | return req->misc.write.out.size; | 762 | return req->misc.write.out.size; |
756 | } | 763 | } |
757 | 764 | ||
758 | static int fuse_write_begin(struct file *file, struct address_space *mapping, | ||
759 | loff_t pos, unsigned len, unsigned flags, | ||
760 | struct page **pagep, void **fsdata) | ||
761 | { | ||
762 | pgoff_t index = pos >> PAGE_CACHE_SHIFT; | ||
763 | |||
764 | *pagep = grab_cache_page_write_begin(mapping, index, flags); | ||
765 | if (!*pagep) | ||
766 | return -ENOMEM; | ||
767 | return 0; | ||
768 | } | ||
769 | |||
770 | void fuse_write_update_size(struct inode *inode, loff_t pos) | 765 | void fuse_write_update_size(struct inode *inode, loff_t pos) |
771 | { | 766 | { |
772 | struct fuse_conn *fc = get_fuse_conn(inode); | 767 | struct fuse_conn *fc = get_fuse_conn(inode); |
@@ -779,62 +774,6 @@ void fuse_write_update_size(struct inode *inode, loff_t pos) | |||
779 | spin_unlock(&fc->lock); | 774 | spin_unlock(&fc->lock); |
780 | } | 775 | } |
781 | 776 | ||
782 | static int fuse_buffered_write(struct file *file, struct inode *inode, | ||
783 | loff_t pos, unsigned count, struct page *page) | ||
784 | { | ||
785 | int err; | ||
786 | size_t nres; | ||
787 | struct fuse_conn *fc = get_fuse_conn(inode); | ||
788 | unsigned offset = pos & (PAGE_CACHE_SIZE - 1); | ||
789 | struct fuse_req *req; | ||
790 | |||
791 | if (is_bad_inode(inode)) | ||
792 | return -EIO; | ||
793 | |||
794 | /* | ||
795 | * Make sure writepages on the same page are not mixed up with | ||
796 | * plain writes. | ||
797 | */ | ||
798 | fuse_wait_on_page_writeback(inode, page->index); | ||
799 | |||
800 | req = fuse_get_req(fc); | ||
801 | if (IS_ERR(req)) | ||
802 | return PTR_ERR(req); | ||
803 | |||
804 | req->in.argpages = 1; | ||
805 | req->num_pages = 1; | ||
806 | req->pages[0] = page; | ||
807 | req->page_offset = offset; | ||
808 | nres = fuse_send_write(req, file, pos, count, NULL); | ||
809 | err = req->out.h.error; | ||
810 | fuse_put_request(fc, req); | ||
811 | if (!err && !nres) | ||
812 | err = -EIO; | ||
813 | if (!err) { | ||
814 | pos += nres; | ||
815 | fuse_write_update_size(inode, pos); | ||
816 | if (count == PAGE_CACHE_SIZE) | ||
817 | SetPageUptodate(page); | ||
818 | } | ||
819 | fuse_invalidate_attr(inode); | ||
820 | return err ? err : nres; | ||
821 | } | ||
822 | |||
823 | static int fuse_write_end(struct file *file, struct address_space *mapping, | ||
824 | loff_t pos, unsigned len, unsigned copied, | ||
825 | struct page *page, void *fsdata) | ||
826 | { | ||
827 | struct inode *inode = mapping->host; | ||
828 | int res = 0; | ||
829 | |||
830 | if (copied) | ||
831 | res = fuse_buffered_write(file, inode, pos, copied, page); | ||
832 | |||
833 | unlock_page(page); | ||
834 | page_cache_release(page); | ||
835 | return res; | ||
836 | } | ||
837 | |||
838 | static size_t fuse_send_write_pages(struct fuse_req *req, struct file *file, | 777 | static size_t fuse_send_write_pages(struct fuse_req *req, struct file *file, |
839 | struct inode *inode, loff_t pos, | 778 | struct inode *inode, loff_t pos, |
840 | size_t count) | 779 | size_t count) |
@@ -908,6 +847,8 @@ static ssize_t fuse_fill_write_pages(struct fuse_req *req, | |||
908 | pagefault_enable(); | 847 | pagefault_enable(); |
909 | flush_dcache_page(page); | 848 | flush_dcache_page(page); |
910 | 849 | ||
850 | mark_page_accessed(page); | ||
851 | |||
911 | if (!tmp) { | 852 | if (!tmp) { |
912 | unlock_page(page); | 853 | unlock_page(page); |
913 | page_cache_release(page); | 854 | page_cache_release(page); |
@@ -1559,11 +1500,14 @@ static int fuse_file_flock(struct file *file, int cmd, struct file_lock *fl) | |||
1559 | struct fuse_conn *fc = get_fuse_conn(inode); | 1500 | struct fuse_conn *fc = get_fuse_conn(inode); |
1560 | int err; | 1501 | int err; |
1561 | 1502 | ||
1562 | if (fc->no_lock) { | 1503 | if (fc->no_flock) { |
1563 | err = flock_lock_file_wait(file, fl); | 1504 | err = flock_lock_file_wait(file, fl); |
1564 | } else { | 1505 | } else { |
1506 | struct fuse_file *ff = file->private_data; | ||
1507 | |||
1565 | /* emulate flock with POSIX locks */ | 1508 | /* emulate flock with POSIX locks */ |
1566 | fl->fl_owner = (fl_owner_t) file; | 1509 | fl->fl_owner = (fl_owner_t) file; |
1510 | ff->flock = true; | ||
1567 | err = fuse_setlk(file, fl, 1); | 1511 | err = fuse_setlk(file, fl, 1); |
1568 | } | 1512 | } |
1569 | 1513 | ||
@@ -2201,8 +2145,6 @@ static const struct address_space_operations fuse_file_aops = { | |||
2201 | .readpage = fuse_readpage, | 2145 | .readpage = fuse_readpage, |
2202 | .writepage = fuse_writepage, | 2146 | .writepage = fuse_writepage, |
2203 | .launder_page = fuse_launder_page, | 2147 | .launder_page = fuse_launder_page, |
2204 | .write_begin = fuse_write_begin, | ||
2205 | .write_end = fuse_write_end, | ||
2206 | .readpages = fuse_readpages, | 2148 | .readpages = fuse_readpages, |
2207 | .set_page_dirty = __set_page_dirty_nobuffers, | 2149 | .set_page_dirty = __set_page_dirty_nobuffers, |
2208 | .bmap = fuse_bmap, | 2150 | .bmap = fuse_bmap, |
diff --git a/fs/fuse/fuse_i.h b/fs/fuse/fuse_i.h index c6aa2d4b8517..cf6db0a93219 100644 --- a/fs/fuse/fuse_i.h +++ b/fs/fuse/fuse_i.h | |||
@@ -135,6 +135,9 @@ struct fuse_file { | |||
135 | 135 | ||
136 | /** Wait queue head for poll */ | 136 | /** Wait queue head for poll */ |
137 | wait_queue_head_t poll_wait; | 137 | wait_queue_head_t poll_wait; |
138 | |||
139 | /** Has flock been performed on this file? */ | ||
140 | bool flock:1; | ||
138 | }; | 141 | }; |
139 | 142 | ||
140 | /** One input argument of a request */ | 143 | /** One input argument of a request */ |
@@ -448,7 +451,7 @@ struct fuse_conn { | |||
448 | /** Is removexattr not implemented by fs? */ | 451 | /** Is removexattr not implemented by fs? */ |
449 | unsigned no_removexattr:1; | 452 | unsigned no_removexattr:1; |
450 | 453 | ||
451 | /** Are file locking primitives not implemented by fs? */ | 454 | /** Are posix file locking primitives not implemented by fs? */ |
452 | unsigned no_lock:1; | 455 | unsigned no_lock:1; |
453 | 456 | ||
454 | /** Is access not implemented by fs? */ | 457 | /** Is access not implemented by fs? */ |
@@ -472,6 +475,9 @@ struct fuse_conn { | |||
472 | /** Don't apply umask to creation modes */ | 475 | /** Don't apply umask to creation modes */ |
473 | unsigned dont_mask:1; | 476 | unsigned dont_mask:1; |
474 | 477 | ||
478 | /** Are BSD file locking primitives not implemented by fs? */ | ||
479 | unsigned no_flock:1; | ||
480 | |||
475 | /** The number of requests waiting for completion */ | 481 | /** The number of requests waiting for completion */ |
476 | atomic_t num_waiting; | 482 | atomic_t num_waiting; |
477 | 483 | ||
diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c index 38f84cd48b67..add96f6ffda5 100644 --- a/fs/fuse/inode.c +++ b/fs/fuse/inode.c | |||
@@ -71,7 +71,7 @@ struct fuse_mount_data { | |||
71 | unsigned blksize; | 71 | unsigned blksize; |
72 | }; | 72 | }; |
73 | 73 | ||
74 | struct fuse_forget_link *fuse_alloc_forget() | 74 | struct fuse_forget_link *fuse_alloc_forget(void) |
75 | { | 75 | { |
76 | return kzalloc(sizeof(struct fuse_forget_link), GFP_KERNEL); | 76 | return kzalloc(sizeof(struct fuse_forget_link), GFP_KERNEL); |
77 | } | 77 | } |
@@ -809,6 +809,13 @@ static void process_init_reply(struct fuse_conn *fc, struct fuse_req *req) | |||
809 | fc->async_read = 1; | 809 | fc->async_read = 1; |
810 | if (!(arg->flags & FUSE_POSIX_LOCKS)) | 810 | if (!(arg->flags & FUSE_POSIX_LOCKS)) |
811 | fc->no_lock = 1; | 811 | fc->no_lock = 1; |
812 | if (arg->minor >= 17) { | ||
813 | if (!(arg->flags & FUSE_FLOCK_LOCKS)) | ||
814 | fc->no_flock = 1; | ||
815 | } else { | ||
816 | if (!(arg->flags & FUSE_POSIX_LOCKS)) | ||
817 | fc->no_flock = 1; | ||
818 | } | ||
812 | if (arg->flags & FUSE_ATOMIC_O_TRUNC) | 819 | if (arg->flags & FUSE_ATOMIC_O_TRUNC) |
813 | fc->atomic_o_trunc = 1; | 820 | fc->atomic_o_trunc = 1; |
814 | if (arg->minor >= 9) { | 821 | if (arg->minor >= 9) { |
@@ -823,6 +830,7 @@ static void process_init_reply(struct fuse_conn *fc, struct fuse_req *req) | |||
823 | } else { | 830 | } else { |
824 | ra_pages = fc->max_read / PAGE_CACHE_SIZE; | 831 | ra_pages = fc->max_read / PAGE_CACHE_SIZE; |
825 | fc->no_lock = 1; | 832 | fc->no_lock = 1; |
833 | fc->no_flock = 1; | ||
826 | } | 834 | } |
827 | 835 | ||
828 | fc->bdi.ra_pages = min(fc->bdi.ra_pages, ra_pages); | 836 | fc->bdi.ra_pages = min(fc->bdi.ra_pages, ra_pages); |
@@ -843,7 +851,8 @@ static void fuse_send_init(struct fuse_conn *fc, struct fuse_req *req) | |||
843 | arg->minor = FUSE_KERNEL_MINOR_VERSION; | 851 | arg->minor = FUSE_KERNEL_MINOR_VERSION; |
844 | arg->max_readahead = fc->bdi.ra_pages * PAGE_CACHE_SIZE; | 852 | arg->max_readahead = fc->bdi.ra_pages * PAGE_CACHE_SIZE; |
845 | arg->flags |= FUSE_ASYNC_READ | FUSE_POSIX_LOCKS | FUSE_ATOMIC_O_TRUNC | | 853 | arg->flags |= FUSE_ASYNC_READ | FUSE_POSIX_LOCKS | FUSE_ATOMIC_O_TRUNC | |
846 | FUSE_EXPORT_SUPPORT | FUSE_BIG_WRITES | FUSE_DONT_MASK; | 854 | FUSE_EXPORT_SUPPORT | FUSE_BIG_WRITES | FUSE_DONT_MASK | |
855 | FUSE_FLOCK_LOCKS; | ||
847 | req->in.h.opcode = FUSE_INIT; | 856 | req->in.h.opcode = FUSE_INIT; |
848 | req->in.numargs = 1; | 857 | req->in.numargs = 1; |
849 | req->in.args[0].size = sizeof(*arg); | 858 | req->in.args[0].size = sizeof(*arg); |
diff --git a/fs/gfs2/log.c b/fs/gfs2/log.c index 85c62923ee29..598646434362 100644 --- a/fs/gfs2/log.c +++ b/fs/gfs2/log.c | |||
@@ -624,9 +624,9 @@ static void log_write_header(struct gfs2_sbd *sdp, u32 flags, int pull) | |||
624 | bh->b_end_io = end_buffer_write_sync; | 624 | bh->b_end_io = end_buffer_write_sync; |
625 | get_bh(bh); | 625 | get_bh(bh); |
626 | if (test_bit(SDF_NOBARRIERS, &sdp->sd_flags)) | 626 | if (test_bit(SDF_NOBARRIERS, &sdp->sd_flags)) |
627 | submit_bh(WRITE_SYNC | REQ_META, bh); | 627 | submit_bh(WRITE_SYNC | REQ_META | REQ_PRIO, bh); |
628 | else | 628 | else |
629 | submit_bh(WRITE_FLUSH_FUA | REQ_META, bh); | 629 | submit_bh(WRITE_FLUSH_FUA | REQ_META | REQ_PRIO, bh); |
630 | wait_on_buffer(bh); | 630 | wait_on_buffer(bh); |
631 | 631 | ||
632 | if (!buffer_uptodate(bh)) | 632 | if (!buffer_uptodate(bh)) |
diff --git a/fs/gfs2/meta_io.c b/fs/gfs2/meta_io.c index 747238cd9f96..be29858900f6 100644 --- a/fs/gfs2/meta_io.c +++ b/fs/gfs2/meta_io.c | |||
@@ -37,7 +37,7 @@ static int gfs2_aspace_writepage(struct page *page, struct writeback_control *wb | |||
37 | { | 37 | { |
38 | struct buffer_head *bh, *head; | 38 | struct buffer_head *bh, *head; |
39 | int nr_underway = 0; | 39 | int nr_underway = 0; |
40 | int write_op = REQ_META | | 40 | int write_op = REQ_META | REQ_PRIO | |
41 | (wbc->sync_mode == WB_SYNC_ALL ? WRITE_SYNC : WRITE); | 41 | (wbc->sync_mode == WB_SYNC_ALL ? WRITE_SYNC : WRITE); |
42 | 42 | ||
43 | BUG_ON(!PageLocked(page)); | 43 | BUG_ON(!PageLocked(page)); |
@@ -225,7 +225,7 @@ int gfs2_meta_read(struct gfs2_glock *gl, u64 blkno, int flags, | |||
225 | } | 225 | } |
226 | bh->b_end_io = end_buffer_read_sync; | 226 | bh->b_end_io = end_buffer_read_sync; |
227 | get_bh(bh); | 227 | get_bh(bh); |
228 | submit_bh(READ_SYNC | REQ_META, bh); | 228 | submit_bh(READ_SYNC | REQ_META | REQ_PRIO, bh); |
229 | if (!(flags & DIO_WAIT)) | 229 | if (!(flags & DIO_WAIT)) |
230 | return 0; | 230 | return 0; |
231 | 231 | ||
@@ -435,7 +435,7 @@ struct buffer_head *gfs2_meta_ra(struct gfs2_glock *gl, u64 dblock, u32 extlen) | |||
435 | if (buffer_uptodate(first_bh)) | 435 | if (buffer_uptodate(first_bh)) |
436 | goto out; | 436 | goto out; |
437 | if (!buffer_locked(first_bh)) | 437 | if (!buffer_locked(first_bh)) |
438 | ll_rw_block(READ_SYNC | REQ_META, 1, &first_bh); | 438 | ll_rw_block(READ_SYNC | REQ_META | REQ_PRIO, 1, &first_bh); |
439 | 439 | ||
440 | dblock++; | 440 | dblock++; |
441 | extlen--; | 441 | extlen--; |
diff --git a/fs/gfs2/ops_fstype.c b/fs/gfs2/ops_fstype.c index 3bc073a4cf82..079587e53849 100644 --- a/fs/gfs2/ops_fstype.c +++ b/fs/gfs2/ops_fstype.c | |||
@@ -224,7 +224,7 @@ static int gfs2_read_super(struct gfs2_sbd *sdp, sector_t sector, int silent) | |||
224 | 224 | ||
225 | bio->bi_end_io = end_bio_io_page; | 225 | bio->bi_end_io = end_bio_io_page; |
226 | bio->bi_private = page; | 226 | bio->bi_private = page; |
227 | submit_bio(READ_SYNC | REQ_META, bio); | 227 | submit_bio(READ_SYNC | REQ_META | REQ_PRIO, bio); |
228 | wait_on_page_locked(page); | 228 | wait_on_page_locked(page); |
229 | bio_put(bio); | 229 | bio_put(bio); |
230 | if (!PageUptodate(page)) { | 230 | if (!PageUptodate(page)) { |
diff --git a/fs/gfs2/quota.c b/fs/gfs2/quota.c index 42e8d23bc047..0e8bb13381e4 100644 --- a/fs/gfs2/quota.c +++ b/fs/gfs2/quota.c | |||
@@ -709,7 +709,7 @@ get_a_page: | |||
709 | set_buffer_uptodate(bh); | 709 | set_buffer_uptodate(bh); |
710 | 710 | ||
711 | if (!buffer_uptodate(bh)) { | 711 | if (!buffer_uptodate(bh)) { |
712 | ll_rw_block(READ_META, 1, &bh); | 712 | ll_rw_block(READ | REQ_META | REQ_PRIO, 1, &bh); |
713 | wait_on_buffer(bh); | 713 | wait_on_buffer(bh); |
714 | if (!buffer_uptodate(bh)) | 714 | if (!buffer_uptodate(bh)) |
715 | goto unlock_out; | 715 | goto unlock_out; |
diff --git a/fs/hfsplus/super.c b/fs/hfsplus/super.c index c106ca22e812..d24a9b666a23 100644 --- a/fs/hfsplus/super.c +++ b/fs/hfsplus/super.c | |||
@@ -344,6 +344,7 @@ static int hfsplus_fill_super(struct super_block *sb, void *data, int silent) | |||
344 | struct inode *root, *inode; | 344 | struct inode *root, *inode; |
345 | struct qstr str; | 345 | struct qstr str; |
346 | struct nls_table *nls = NULL; | 346 | struct nls_table *nls = NULL; |
347 | u64 last_fs_block, last_fs_page; | ||
347 | int err; | 348 | int err; |
348 | 349 | ||
349 | err = -EINVAL; | 350 | err = -EINVAL; |
@@ -399,9 +400,13 @@ static int hfsplus_fill_super(struct super_block *sb, void *data, int silent) | |||
399 | if (!sbi->rsrc_clump_blocks) | 400 | if (!sbi->rsrc_clump_blocks) |
400 | sbi->rsrc_clump_blocks = 1; | 401 | sbi->rsrc_clump_blocks = 1; |
401 | 402 | ||
402 | err = generic_check_addressable(sbi->alloc_blksz_shift, | 403 | err = -EFBIG; |
403 | sbi->total_blocks); | 404 | last_fs_block = sbi->total_blocks - 1; |
404 | if (err) { | 405 | last_fs_page = (last_fs_block << sbi->alloc_blksz_shift) >> |
406 | PAGE_CACHE_SHIFT; | ||
407 | |||
408 | if ((last_fs_block > (sector_t)(~0ULL) >> (sbi->alloc_blksz_shift - 9)) || | ||
409 | (last_fs_page > (pgoff_t)(~0ULL))) { | ||
405 | printk(KERN_ERR "hfs: filesystem size too large.\n"); | 410 | printk(KERN_ERR "hfs: filesystem size too large.\n"); |
406 | goto out_free_vhdr; | 411 | goto out_free_vhdr; |
407 | } | 412 | } |
@@ -525,8 +530,8 @@ out_close_cat_tree: | |||
525 | out_close_ext_tree: | 530 | out_close_ext_tree: |
526 | hfs_btree_close(sbi->ext_tree); | 531 | hfs_btree_close(sbi->ext_tree); |
527 | out_free_vhdr: | 532 | out_free_vhdr: |
528 | kfree(sbi->s_vhdr); | 533 | kfree(sbi->s_vhdr_buf); |
529 | kfree(sbi->s_backup_vhdr); | 534 | kfree(sbi->s_backup_vhdr_buf); |
530 | out_unload_nls: | 535 | out_unload_nls: |
531 | unload_nls(sbi->nls); | 536 | unload_nls(sbi->nls); |
532 | unload_nls(nls); | 537 | unload_nls(nls); |
diff --git a/fs/hfsplus/wrapper.c b/fs/hfsplus/wrapper.c index 10e515a0d452..7daf4b852d1c 100644 --- a/fs/hfsplus/wrapper.c +++ b/fs/hfsplus/wrapper.c | |||
@@ -272,9 +272,9 @@ reread: | |||
272 | return 0; | 272 | return 0; |
273 | 273 | ||
274 | out_free_backup_vhdr: | 274 | out_free_backup_vhdr: |
275 | kfree(sbi->s_backup_vhdr); | 275 | kfree(sbi->s_backup_vhdr_buf); |
276 | out_free_vhdr: | 276 | out_free_vhdr: |
277 | kfree(sbi->s_vhdr); | 277 | kfree(sbi->s_vhdr_buf); |
278 | out: | 278 | out: |
279 | return error; | 279 | return error; |
280 | } | 280 | } |
diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c index 87b6e0421c12..ec889538e5a6 100644 --- a/fs/hugetlbfs/inode.c +++ b/fs/hugetlbfs/inode.c | |||
@@ -491,6 +491,7 @@ static struct inode *hugetlbfs_get_inode(struct super_block *sb, uid_t uid, | |||
491 | inode->i_op = &page_symlink_inode_operations; | 491 | inode->i_op = &page_symlink_inode_operations; |
492 | break; | 492 | break; |
493 | } | 493 | } |
494 | lockdep_annotate_inode_mutex_key(inode); | ||
494 | } | 495 | } |
495 | return inode; | 496 | return inode; |
496 | } | 497 | } |
diff --git a/fs/inode.c b/fs/inode.c index 73920d555c88..ec7924696a13 100644 --- a/fs/inode.c +++ b/fs/inode.c | |||
@@ -848,16 +848,9 @@ struct inode *new_inode(struct super_block *sb) | |||
848 | } | 848 | } |
849 | EXPORT_SYMBOL(new_inode); | 849 | EXPORT_SYMBOL(new_inode); |
850 | 850 | ||
851 | /** | ||
852 | * unlock_new_inode - clear the I_NEW state and wake up any waiters | ||
853 | * @inode: new inode to unlock | ||
854 | * | ||
855 | * Called when the inode is fully initialised to clear the new state of the | ||
856 | * inode and wake up anyone waiting for the inode to finish initialisation. | ||
857 | */ | ||
858 | void unlock_new_inode(struct inode *inode) | ||
859 | { | ||
860 | #ifdef CONFIG_DEBUG_LOCK_ALLOC | 851 | #ifdef CONFIG_DEBUG_LOCK_ALLOC |
852 | void lockdep_annotate_inode_mutex_key(struct inode *inode) | ||
853 | { | ||
861 | if (S_ISDIR(inode->i_mode)) { | 854 | if (S_ISDIR(inode->i_mode)) { |
862 | struct file_system_type *type = inode->i_sb->s_type; | 855 | struct file_system_type *type = inode->i_sb->s_type; |
863 | 856 | ||
@@ -873,7 +866,20 @@ void unlock_new_inode(struct inode *inode) | |||
873 | &type->i_mutex_dir_key); | 866 | &type->i_mutex_dir_key); |
874 | } | 867 | } |
875 | } | 868 | } |
869 | } | ||
870 | EXPORT_SYMBOL(lockdep_annotate_inode_mutex_key); | ||
876 | #endif | 871 | #endif |
872 | |||
873 | /** | ||
874 | * unlock_new_inode - clear the I_NEW state and wake up any waiters | ||
875 | * @inode: new inode to unlock | ||
876 | * | ||
877 | * Called when the inode is fully initialised to clear the new state of the | ||
878 | * inode and wake up anyone waiting for the inode to finish initialisation. | ||
879 | */ | ||
880 | void unlock_new_inode(struct inode *inode) | ||
881 | { | ||
882 | lockdep_annotate_inode_mutex_key(inode); | ||
877 | spin_lock(&inode->i_lock); | 883 | spin_lock(&inode->i_lock); |
878 | WARN_ON(!(inode->i_state & I_NEW)); | 884 | WARN_ON(!(inode->i_state & I_NEW)); |
879 | inode->i_state &= ~I_NEW; | 885 | inode->i_state &= ~I_NEW; |
diff --git a/fs/namei.c b/fs/namei.c index 2826db35dc25..0b3138de2a3b 100644 --- a/fs/namei.c +++ b/fs/namei.c | |||
@@ -721,31 +721,22 @@ static int follow_automount(struct path *path, unsigned flags, | |||
721 | if (!path->dentry->d_op || !path->dentry->d_op->d_automount) | 721 | if (!path->dentry->d_op || !path->dentry->d_op->d_automount) |
722 | return -EREMOTE; | 722 | return -EREMOTE; |
723 | 723 | ||
724 | /* We don't want to mount if someone supplied AT_NO_AUTOMOUNT | 724 | /* We don't want to mount if someone's just doing a stat - |
725 | * and this is the terminal part of the path. | 725 | * unless they're stat'ing a directory and appended a '/' to |
726 | * the name. | ||
727 | * | ||
728 | * We do, however, want to mount if someone wants to open or | ||
729 | * create a file of any type under the mountpoint, wants to | ||
730 | * traverse through the mountpoint or wants to open the | ||
731 | * mounted directory. Also, autofs may mark negative dentries | ||
732 | * as being automount points. These will need the attentions | ||
733 | * of the daemon to instantiate them before they can be used. | ||
726 | */ | 734 | */ |
727 | if ((flags & LOOKUP_NO_AUTOMOUNT) && !(flags & LOOKUP_PARENT)) | 735 | if (!(flags & (LOOKUP_PARENT | LOOKUP_DIRECTORY | |
728 | return -EISDIR; /* we actually want to stop here */ | 736 | LOOKUP_OPEN | LOOKUP_CREATE | LOOKUP_AUTOMOUNT)) && |
737 | path->dentry->d_inode) | ||
738 | return -EISDIR; | ||
729 | 739 | ||
730 | /* | ||
731 | * We don't want to mount if someone's just doing a stat and they've | ||
732 | * set AT_SYMLINK_NOFOLLOW - unless they're stat'ing a directory and | ||
733 | * appended a '/' to the name. | ||
734 | */ | ||
735 | if (!(flags & LOOKUP_FOLLOW)) { | ||
736 | /* We do, however, want to mount if someone wants to open or | ||
737 | * create a file of any type under the mountpoint, wants to | ||
738 | * traverse through the mountpoint or wants to open the mounted | ||
739 | * directory. | ||
740 | * Also, autofs may mark negative dentries as being automount | ||
741 | * points. These will need the attentions of the daemon to | ||
742 | * instantiate them before they can be used. | ||
743 | */ | ||
744 | if (!(flags & (LOOKUP_PARENT | LOOKUP_DIRECTORY | | ||
745 | LOOKUP_OPEN | LOOKUP_CREATE)) && | ||
746 | path->dentry->d_inode) | ||
747 | return -EISDIR; | ||
748 | } | ||
749 | current->total_link_count++; | 740 | current->total_link_count++; |
750 | if (current->total_link_count >= 40) | 741 | if (current->total_link_count >= 40) |
751 | return -ELOOP; | 742 | return -ELOOP; |
@@ -2619,6 +2610,7 @@ int vfs_rmdir(struct inode *dir, struct dentry *dentry) | |||
2619 | if (!dir->i_op->rmdir) | 2610 | if (!dir->i_op->rmdir) |
2620 | return -EPERM; | 2611 | return -EPERM; |
2621 | 2612 | ||
2613 | dget(dentry); | ||
2622 | mutex_lock(&dentry->d_inode->i_mutex); | 2614 | mutex_lock(&dentry->d_inode->i_mutex); |
2623 | 2615 | ||
2624 | error = -EBUSY; | 2616 | error = -EBUSY; |
@@ -2639,6 +2631,7 @@ int vfs_rmdir(struct inode *dir, struct dentry *dentry) | |||
2639 | 2631 | ||
2640 | out: | 2632 | out: |
2641 | mutex_unlock(&dentry->d_inode->i_mutex); | 2633 | mutex_unlock(&dentry->d_inode->i_mutex); |
2634 | dput(dentry); | ||
2642 | if (!error) | 2635 | if (!error) |
2643 | d_delete(dentry); | 2636 | d_delete(dentry); |
2644 | return error; | 2637 | return error; |
@@ -3028,6 +3021,7 @@ static int vfs_rename_dir(struct inode *old_dir, struct dentry *old_dentry, | |||
3028 | if (error) | 3021 | if (error) |
3029 | return error; | 3022 | return error; |
3030 | 3023 | ||
3024 | dget(new_dentry); | ||
3031 | if (target) | 3025 | if (target) |
3032 | mutex_lock(&target->i_mutex); | 3026 | mutex_lock(&target->i_mutex); |
3033 | 3027 | ||
@@ -3048,6 +3042,7 @@ static int vfs_rename_dir(struct inode *old_dir, struct dentry *old_dentry, | |||
3048 | out: | 3042 | out: |
3049 | if (target) | 3043 | if (target) |
3050 | mutex_unlock(&target->i_mutex); | 3044 | mutex_unlock(&target->i_mutex); |
3045 | dput(new_dentry); | ||
3051 | if (!error) | 3046 | if (!error) |
3052 | if (!(old_dir->i_sb->s_type->fs_flags & FS_RENAME_DOES_D_MOVE)) | 3047 | if (!(old_dir->i_sb->s_type->fs_flags & FS_RENAME_DOES_D_MOVE)) |
3053 | d_move(old_dentry,new_dentry); | 3048 | d_move(old_dentry,new_dentry); |
diff --git a/fs/namespace.c b/fs/namespace.c index 22bfe8273c68..b4febb29d3bb 100644 --- a/fs/namespace.c +++ b/fs/namespace.c | |||
@@ -1757,7 +1757,7 @@ static int do_loopback(struct path *path, char *old_name, | |||
1757 | return err; | 1757 | return err; |
1758 | if (!old_name || !*old_name) | 1758 | if (!old_name || !*old_name) |
1759 | return -EINVAL; | 1759 | return -EINVAL; |
1760 | err = kern_path(old_name, LOOKUP_FOLLOW, &old_path); | 1760 | err = kern_path(old_name, LOOKUP_FOLLOW|LOOKUP_AUTOMOUNT, &old_path); |
1761 | if (err) | 1761 | if (err) |
1762 | return err; | 1762 | return err; |
1763 | 1763 | ||
diff --git a/fs/nfs/nfs4_fs.h b/fs/nfs/nfs4_fs.h index 1ec1a85fa71c..3e93e9a1bee1 100644 --- a/fs/nfs/nfs4_fs.h +++ b/fs/nfs/nfs4_fs.h | |||
@@ -56,6 +56,9 @@ enum nfs4_session_state { | |||
56 | NFS4_SESSION_DRAINING, | 56 | NFS4_SESSION_DRAINING, |
57 | }; | 57 | }; |
58 | 58 | ||
59 | #define NFS4_RENEW_TIMEOUT 0x01 | ||
60 | #define NFS4_RENEW_DELEGATION_CB 0x02 | ||
61 | |||
59 | struct nfs4_minor_version_ops { | 62 | struct nfs4_minor_version_ops { |
60 | u32 minor_version; | 63 | u32 minor_version; |
61 | 64 | ||
@@ -225,7 +228,7 @@ struct nfs4_state_recovery_ops { | |||
225 | }; | 228 | }; |
226 | 229 | ||
227 | struct nfs4_state_maintenance_ops { | 230 | struct nfs4_state_maintenance_ops { |
228 | int (*sched_state_renewal)(struct nfs_client *, struct rpc_cred *); | 231 | int (*sched_state_renewal)(struct nfs_client *, struct rpc_cred *, unsigned); |
229 | struct rpc_cred * (*get_state_renewal_cred_locked)(struct nfs_client *); | 232 | struct rpc_cred * (*get_state_renewal_cred_locked)(struct nfs_client *); |
230 | int (*renew_lease)(struct nfs_client *, struct rpc_cred *); | 233 | int (*renew_lease)(struct nfs_client *, struct rpc_cred *); |
231 | }; | 234 | }; |
@@ -237,8 +240,6 @@ extern const struct inode_operations nfs4_dir_inode_operations; | |||
237 | extern int nfs4_proc_setclientid(struct nfs_client *, u32, unsigned short, struct rpc_cred *, struct nfs4_setclientid_res *); | 240 | extern int nfs4_proc_setclientid(struct nfs_client *, u32, unsigned short, struct rpc_cred *, struct nfs4_setclientid_res *); |
238 | extern int nfs4_proc_setclientid_confirm(struct nfs_client *, struct nfs4_setclientid_res *arg, struct rpc_cred *); | 241 | extern int nfs4_proc_setclientid_confirm(struct nfs_client *, struct nfs4_setclientid_res *arg, struct rpc_cred *); |
239 | extern int nfs4_proc_exchange_id(struct nfs_client *clp, struct rpc_cred *cred); | 242 | extern int nfs4_proc_exchange_id(struct nfs_client *clp, struct rpc_cred *cred); |
240 | extern int nfs4_proc_async_renew(struct nfs_client *, struct rpc_cred *); | ||
241 | extern int nfs4_proc_renew(struct nfs_client *, struct rpc_cred *); | ||
242 | extern int nfs4_init_clientid(struct nfs_client *, struct rpc_cred *); | 243 | extern int nfs4_init_clientid(struct nfs_client *, struct rpc_cred *); |
243 | extern int nfs41_init_clientid(struct nfs_client *, struct rpc_cred *); | 244 | extern int nfs41_init_clientid(struct nfs_client *, struct rpc_cred *); |
244 | extern int nfs4_do_close(struct nfs4_state *state, gfp_t gfp_mask, int wait, bool roc); | 245 | extern int nfs4_do_close(struct nfs4_state *state, gfp_t gfp_mask, int wait, bool roc); |
@@ -349,6 +350,7 @@ extern void nfs4_close_sync(struct nfs4_state *, fmode_t); | |||
349 | extern void nfs4_state_set_mode_locked(struct nfs4_state *, fmode_t); | 350 | extern void nfs4_state_set_mode_locked(struct nfs4_state *, fmode_t); |
350 | extern void nfs4_schedule_lease_recovery(struct nfs_client *); | 351 | extern void nfs4_schedule_lease_recovery(struct nfs_client *); |
351 | extern void nfs4_schedule_state_manager(struct nfs_client *); | 352 | extern void nfs4_schedule_state_manager(struct nfs_client *); |
353 | extern void nfs4_schedule_path_down_recovery(struct nfs_client *clp); | ||
352 | extern void nfs4_schedule_stateid_recovery(const struct nfs_server *, struct nfs4_state *); | 354 | extern void nfs4_schedule_stateid_recovery(const struct nfs_server *, struct nfs4_state *); |
353 | extern void nfs41_handle_sequence_flag_errors(struct nfs_client *clp, u32 flags); | 355 | extern void nfs41_handle_sequence_flag_errors(struct nfs_client *clp, u32 flags); |
354 | extern void nfs41_handle_recall_slot(struct nfs_client *clp); | 356 | extern void nfs41_handle_recall_slot(struct nfs_client *clp); |
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index 8c77039e7a81..4700fae1ada0 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c | |||
@@ -3374,9 +3374,13 @@ static void nfs4_renew_done(struct rpc_task *task, void *calldata) | |||
3374 | 3374 | ||
3375 | if (task->tk_status < 0) { | 3375 | if (task->tk_status < 0) { |
3376 | /* Unless we're shutting down, schedule state recovery! */ | 3376 | /* Unless we're shutting down, schedule state recovery! */ |
3377 | if (test_bit(NFS_CS_RENEWD, &clp->cl_res_state) != 0) | 3377 | if (test_bit(NFS_CS_RENEWD, &clp->cl_res_state) == 0) |
3378 | return; | ||
3379 | if (task->tk_status != NFS4ERR_CB_PATH_DOWN) { | ||
3378 | nfs4_schedule_lease_recovery(clp); | 3380 | nfs4_schedule_lease_recovery(clp); |
3379 | return; | 3381 | return; |
3382 | } | ||
3383 | nfs4_schedule_path_down_recovery(clp); | ||
3380 | } | 3384 | } |
3381 | do_renew_lease(clp, timestamp); | 3385 | do_renew_lease(clp, timestamp); |
3382 | } | 3386 | } |
@@ -3386,7 +3390,7 @@ static const struct rpc_call_ops nfs4_renew_ops = { | |||
3386 | .rpc_release = nfs4_renew_release, | 3390 | .rpc_release = nfs4_renew_release, |
3387 | }; | 3391 | }; |
3388 | 3392 | ||
3389 | int nfs4_proc_async_renew(struct nfs_client *clp, struct rpc_cred *cred) | 3393 | static int nfs4_proc_async_renew(struct nfs_client *clp, struct rpc_cred *cred, unsigned renew_flags) |
3390 | { | 3394 | { |
3391 | struct rpc_message msg = { | 3395 | struct rpc_message msg = { |
3392 | .rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_RENEW], | 3396 | .rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_RENEW], |
@@ -3395,9 +3399,11 @@ int nfs4_proc_async_renew(struct nfs_client *clp, struct rpc_cred *cred) | |||
3395 | }; | 3399 | }; |
3396 | struct nfs4_renewdata *data; | 3400 | struct nfs4_renewdata *data; |
3397 | 3401 | ||
3402 | if (renew_flags == 0) | ||
3403 | return 0; | ||
3398 | if (!atomic_inc_not_zero(&clp->cl_count)) | 3404 | if (!atomic_inc_not_zero(&clp->cl_count)) |
3399 | return -EIO; | 3405 | return -EIO; |
3400 | data = kmalloc(sizeof(*data), GFP_KERNEL); | 3406 | data = kmalloc(sizeof(*data), GFP_NOFS); |
3401 | if (data == NULL) | 3407 | if (data == NULL) |
3402 | return -ENOMEM; | 3408 | return -ENOMEM; |
3403 | data->client = clp; | 3409 | data->client = clp; |
@@ -3406,7 +3412,7 @@ int nfs4_proc_async_renew(struct nfs_client *clp, struct rpc_cred *cred) | |||
3406 | &nfs4_renew_ops, data); | 3412 | &nfs4_renew_ops, data); |
3407 | } | 3413 | } |
3408 | 3414 | ||
3409 | int nfs4_proc_renew(struct nfs_client *clp, struct rpc_cred *cred) | 3415 | static int nfs4_proc_renew(struct nfs_client *clp, struct rpc_cred *cred) |
3410 | { | 3416 | { |
3411 | struct rpc_message msg = { | 3417 | struct rpc_message msg = { |
3412 | .rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_RENEW], | 3418 | .rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_RENEW], |
@@ -5504,11 +5510,13 @@ static struct rpc_task *_nfs41_proc_sequence(struct nfs_client *clp, struct rpc_ | |||
5504 | return rpc_run_task(&task_setup_data); | 5510 | return rpc_run_task(&task_setup_data); |
5505 | } | 5511 | } |
5506 | 5512 | ||
5507 | static int nfs41_proc_async_sequence(struct nfs_client *clp, struct rpc_cred *cred) | 5513 | static int nfs41_proc_async_sequence(struct nfs_client *clp, struct rpc_cred *cred, unsigned renew_flags) |
5508 | { | 5514 | { |
5509 | struct rpc_task *task; | 5515 | struct rpc_task *task; |
5510 | int ret = 0; | 5516 | int ret = 0; |
5511 | 5517 | ||
5518 | if ((renew_flags & NFS4_RENEW_TIMEOUT) == 0) | ||
5519 | return 0; | ||
5512 | task = _nfs41_proc_sequence(clp, cred); | 5520 | task = _nfs41_proc_sequence(clp, cred); |
5513 | if (IS_ERR(task)) | 5521 | if (IS_ERR(task)) |
5514 | ret = PTR_ERR(task); | 5522 | ret = PTR_ERR(task); |
diff --git a/fs/nfs/nfs4renewd.c b/fs/nfs/nfs4renewd.c index df8e7f3ca56d..dc484c0eae7f 100644 --- a/fs/nfs/nfs4renewd.c +++ b/fs/nfs/nfs4renewd.c | |||
@@ -60,6 +60,7 @@ nfs4_renew_state(struct work_struct *work) | |||
60 | struct rpc_cred *cred; | 60 | struct rpc_cred *cred; |
61 | long lease; | 61 | long lease; |
62 | unsigned long last, now; | 62 | unsigned long last, now; |
63 | unsigned renew_flags = 0; | ||
63 | 64 | ||
64 | ops = clp->cl_mvops->state_renewal_ops; | 65 | ops = clp->cl_mvops->state_renewal_ops; |
65 | dprintk("%s: start\n", __func__); | 66 | dprintk("%s: start\n", __func__); |
@@ -72,18 +73,23 @@ nfs4_renew_state(struct work_struct *work) | |||
72 | last = clp->cl_last_renewal; | 73 | last = clp->cl_last_renewal; |
73 | now = jiffies; | 74 | now = jiffies; |
74 | /* Are we close to a lease timeout? */ | 75 | /* Are we close to a lease timeout? */ |
75 | if (time_after(now, last + lease/3)) { | 76 | if (time_after(now, last + lease/3)) |
77 | renew_flags |= NFS4_RENEW_TIMEOUT; | ||
78 | if (nfs_delegations_present(clp)) | ||
79 | renew_flags |= NFS4_RENEW_DELEGATION_CB; | ||
80 | |||
81 | if (renew_flags != 0) { | ||
76 | cred = ops->get_state_renewal_cred_locked(clp); | 82 | cred = ops->get_state_renewal_cred_locked(clp); |
77 | spin_unlock(&clp->cl_lock); | 83 | spin_unlock(&clp->cl_lock); |
78 | if (cred == NULL) { | 84 | if (cred == NULL) { |
79 | if (!nfs_delegations_present(clp)) { | 85 | if (!(renew_flags & NFS4_RENEW_DELEGATION_CB)) { |
80 | set_bit(NFS4CLNT_LEASE_EXPIRED, &clp->cl_state); | 86 | set_bit(NFS4CLNT_LEASE_EXPIRED, &clp->cl_state); |
81 | goto out; | 87 | goto out; |
82 | } | 88 | } |
83 | nfs_expire_all_delegations(clp); | 89 | nfs_expire_all_delegations(clp); |
84 | } else { | 90 | } else { |
85 | /* Queue an asynchronous RENEW. */ | 91 | /* Queue an asynchronous RENEW. */ |
86 | ops->sched_state_renewal(clp, cred); | 92 | ops->sched_state_renewal(clp, cred, renew_flags); |
87 | put_rpccred(cred); | 93 | put_rpccred(cred); |
88 | goto out_exp; | 94 | goto out_exp; |
89 | } | 95 | } |
diff --git a/fs/nfs/nfs4state.c b/fs/nfs/nfs4state.c index 72ab97ef3d61..39914be40b03 100644 --- a/fs/nfs/nfs4state.c +++ b/fs/nfs/nfs4state.c | |||
@@ -1038,6 +1038,12 @@ void nfs4_schedule_lease_recovery(struct nfs_client *clp) | |||
1038 | nfs4_schedule_state_manager(clp); | 1038 | nfs4_schedule_state_manager(clp); |
1039 | } | 1039 | } |
1040 | 1040 | ||
1041 | void nfs4_schedule_path_down_recovery(struct nfs_client *clp) | ||
1042 | { | ||
1043 | nfs_handle_cb_pathdown(clp); | ||
1044 | nfs4_schedule_state_manager(clp); | ||
1045 | } | ||
1046 | |||
1041 | static int nfs4_state_mark_reclaim_reboot(struct nfs_client *clp, struct nfs4_state *state) | 1047 | static int nfs4_state_mark_reclaim_reboot(struct nfs_client *clp, struct nfs4_state *state) |
1042 | { | 1048 | { |
1043 | 1049 | ||
diff --git a/fs/nfs/super.c b/fs/nfs/super.c index b961ceac66b4..5b19b6aabe18 100644 --- a/fs/nfs/super.c +++ b/fs/nfs/super.c | |||
@@ -2035,9 +2035,6 @@ static inline void nfs_initialise_sb(struct super_block *sb) | |||
2035 | sb->s_blocksize = nfs_block_bits(server->wsize, | 2035 | sb->s_blocksize = nfs_block_bits(server->wsize, |
2036 | &sb->s_blocksize_bits); | 2036 | &sb->s_blocksize_bits); |
2037 | 2037 | ||
2038 | if (server->flags & NFS_MOUNT_NOAC) | ||
2039 | sb->s_flags |= MS_SYNCHRONOUS; | ||
2040 | |||
2041 | sb->s_bdi = &server->backing_dev_info; | 2038 | sb->s_bdi = &server->backing_dev_info; |
2042 | 2039 | ||
2043 | nfs_super_set_maxbytes(sb, server->maxfilesize); | 2040 | nfs_super_set_maxbytes(sb, server->maxfilesize); |
@@ -2249,6 +2246,10 @@ static struct dentry *nfs_fs_mount(struct file_system_type *fs_type, | |||
2249 | if (server->flags & NFS_MOUNT_UNSHARED) | 2246 | if (server->flags & NFS_MOUNT_UNSHARED) |
2250 | compare_super = NULL; | 2247 | compare_super = NULL; |
2251 | 2248 | ||
2249 | /* -o noac implies -o sync */ | ||
2250 | if (server->flags & NFS_MOUNT_NOAC) | ||
2251 | sb_mntdata.mntflags |= MS_SYNCHRONOUS; | ||
2252 | |||
2252 | /* Get a superblock - note that we may end up sharing one that already exists */ | 2253 | /* Get a superblock - note that we may end up sharing one that already exists */ |
2253 | s = sget(fs_type, compare_super, nfs_set_super, &sb_mntdata); | 2254 | s = sget(fs_type, compare_super, nfs_set_super, &sb_mntdata); |
2254 | if (IS_ERR(s)) { | 2255 | if (IS_ERR(s)) { |
@@ -2361,6 +2362,10 @@ nfs_xdev_mount(struct file_system_type *fs_type, int flags, | |||
2361 | if (server->flags & NFS_MOUNT_UNSHARED) | 2362 | if (server->flags & NFS_MOUNT_UNSHARED) |
2362 | compare_super = NULL; | 2363 | compare_super = NULL; |
2363 | 2364 | ||
2365 | /* -o noac implies -o sync */ | ||
2366 | if (server->flags & NFS_MOUNT_NOAC) | ||
2367 | sb_mntdata.mntflags |= MS_SYNCHRONOUS; | ||
2368 | |||
2364 | /* Get a superblock - note that we may end up sharing one that already exists */ | 2369 | /* Get a superblock - note that we may end up sharing one that already exists */ |
2365 | s = sget(&nfs_fs_type, compare_super, nfs_set_super, &sb_mntdata); | 2370 | s = sget(&nfs_fs_type, compare_super, nfs_set_super, &sb_mntdata); |
2366 | if (IS_ERR(s)) { | 2371 | if (IS_ERR(s)) { |
@@ -2628,6 +2633,10 @@ nfs4_remote_mount(struct file_system_type *fs_type, int flags, | |||
2628 | if (server->flags & NFS4_MOUNT_UNSHARED) | 2633 | if (server->flags & NFS4_MOUNT_UNSHARED) |
2629 | compare_super = NULL; | 2634 | compare_super = NULL; |
2630 | 2635 | ||
2636 | /* -o noac implies -o sync */ | ||
2637 | if (server->flags & NFS_MOUNT_NOAC) | ||
2638 | sb_mntdata.mntflags |= MS_SYNCHRONOUS; | ||
2639 | |||
2631 | /* Get a superblock - note that we may end up sharing one that already exists */ | 2640 | /* Get a superblock - note that we may end up sharing one that already exists */ |
2632 | s = sget(&nfs4_fs_type, compare_super, nfs_set_super, &sb_mntdata); | 2641 | s = sget(&nfs4_fs_type, compare_super, nfs_set_super, &sb_mntdata); |
2633 | if (IS_ERR(s)) { | 2642 | if (IS_ERR(s)) { |
@@ -2789,7 +2798,7 @@ static struct dentry *nfs_follow_remote_path(struct vfsmount *root_mnt, | |||
2789 | goto out_put_mnt_ns; | 2798 | goto out_put_mnt_ns; |
2790 | 2799 | ||
2791 | ret = vfs_path_lookup(root_mnt->mnt_root, root_mnt, | 2800 | ret = vfs_path_lookup(root_mnt->mnt_root, root_mnt, |
2792 | export_path, LOOKUP_FOLLOW, &path); | 2801 | export_path, LOOKUP_FOLLOW|LOOKUP_AUTOMOUNT, &path); |
2793 | 2802 | ||
2794 | nfs_referral_loop_unprotect(); | 2803 | nfs_referral_loop_unprotect(); |
2795 | put_mnt_ns(ns_private); | 2804 | put_mnt_ns(ns_private); |
@@ -2916,6 +2925,10 @@ nfs4_xdev_mount(struct file_system_type *fs_type, int flags, | |||
2916 | if (server->flags & NFS4_MOUNT_UNSHARED) | 2925 | if (server->flags & NFS4_MOUNT_UNSHARED) |
2917 | compare_super = NULL; | 2926 | compare_super = NULL; |
2918 | 2927 | ||
2928 | /* -o noac implies -o sync */ | ||
2929 | if (server->flags & NFS_MOUNT_NOAC) | ||
2930 | sb_mntdata.mntflags |= MS_SYNCHRONOUS; | ||
2931 | |||
2919 | /* Get a superblock - note that we may end up sharing one that already exists */ | 2932 | /* Get a superblock - note that we may end up sharing one that already exists */ |
2920 | s = sget(&nfs4_fs_type, compare_super, nfs_set_super, &sb_mntdata); | 2933 | s = sget(&nfs4_fs_type, compare_super, nfs_set_super, &sb_mntdata); |
2921 | if (IS_ERR(s)) { | 2934 | if (IS_ERR(s)) { |
@@ -3003,6 +3016,10 @@ nfs4_remote_referral_mount(struct file_system_type *fs_type, int flags, | |||
3003 | if (server->flags & NFS4_MOUNT_UNSHARED) | 3016 | if (server->flags & NFS4_MOUNT_UNSHARED) |
3004 | compare_super = NULL; | 3017 | compare_super = NULL; |
3005 | 3018 | ||
3019 | /* -o noac implies -o sync */ | ||
3020 | if (server->flags & NFS_MOUNT_NOAC) | ||
3021 | sb_mntdata.mntflags |= MS_SYNCHRONOUS; | ||
3022 | |||
3006 | /* Get a superblock - note that we may end up sharing one that already exists */ | 3023 | /* Get a superblock - note that we may end up sharing one that already exists */ |
3007 | s = sget(&nfs4_fs_type, compare_super, nfs_set_super, &sb_mntdata); | 3024 | s = sget(&nfs4_fs_type, compare_super, nfs_set_super, &sb_mntdata); |
3008 | if (IS_ERR(s)) { | 3025 | if (IS_ERR(s)) { |
diff --git a/fs/nfs/write.c b/fs/nfs/write.c index b39b37f80913..c9bd2a6b7d4b 100644 --- a/fs/nfs/write.c +++ b/fs/nfs/write.c | |||
@@ -958,7 +958,7 @@ static int nfs_flush_multi(struct nfs_pageio_descriptor *desc, struct list_head | |||
958 | if (!data) | 958 | if (!data) |
959 | goto out_bad; | 959 | goto out_bad; |
960 | data->pagevec[0] = page; | 960 | data->pagevec[0] = page; |
961 | nfs_write_rpcsetup(req, data, wsize, offset, desc->pg_ioflags); | 961 | nfs_write_rpcsetup(req, data, len, offset, desc->pg_ioflags); |
962 | list_add(&data->list, res); | 962 | list_add(&data->list, res); |
963 | requests++; | 963 | requests++; |
964 | nbytes -= len; | 964 | nbytes -= len; |
diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c index 25b6a887adb9..5afaa58a8630 100644 --- a/fs/proc/task_mmu.c +++ b/fs/proc/task_mmu.c | |||
@@ -877,30 +877,54 @@ struct numa_maps_private { | |||
877 | struct numa_maps md; | 877 | struct numa_maps md; |
878 | }; | 878 | }; |
879 | 879 | ||
880 | static void gather_stats(struct page *page, struct numa_maps *md, int pte_dirty) | 880 | static void gather_stats(struct page *page, struct numa_maps *md, int pte_dirty, |
881 | unsigned long nr_pages) | ||
881 | { | 882 | { |
882 | int count = page_mapcount(page); | 883 | int count = page_mapcount(page); |
883 | 884 | ||
884 | md->pages++; | 885 | md->pages += nr_pages; |
885 | if (pte_dirty || PageDirty(page)) | 886 | if (pte_dirty || PageDirty(page)) |
886 | md->dirty++; | 887 | md->dirty += nr_pages; |
887 | 888 | ||
888 | if (PageSwapCache(page)) | 889 | if (PageSwapCache(page)) |
889 | md->swapcache++; | 890 | md->swapcache += nr_pages; |
890 | 891 | ||
891 | if (PageActive(page) || PageUnevictable(page)) | 892 | if (PageActive(page) || PageUnevictable(page)) |
892 | md->active++; | 893 | md->active += nr_pages; |
893 | 894 | ||
894 | if (PageWriteback(page)) | 895 | if (PageWriteback(page)) |
895 | md->writeback++; | 896 | md->writeback += nr_pages; |
896 | 897 | ||
897 | if (PageAnon(page)) | 898 | if (PageAnon(page)) |
898 | md->anon++; | 899 | md->anon += nr_pages; |
899 | 900 | ||
900 | if (count > md->mapcount_max) | 901 | if (count > md->mapcount_max) |
901 | md->mapcount_max = count; | 902 | md->mapcount_max = count; |
902 | 903 | ||
903 | md->node[page_to_nid(page)]++; | 904 | md->node[page_to_nid(page)] += nr_pages; |
905 | } | ||
906 | |||
907 | static struct page *can_gather_numa_stats(pte_t pte, struct vm_area_struct *vma, | ||
908 | unsigned long addr) | ||
909 | { | ||
910 | struct page *page; | ||
911 | int nid; | ||
912 | |||
913 | if (!pte_present(pte)) | ||
914 | return NULL; | ||
915 | |||
916 | page = vm_normal_page(vma, addr, pte); | ||
917 | if (!page) | ||
918 | return NULL; | ||
919 | |||
920 | if (PageReserved(page)) | ||
921 | return NULL; | ||
922 | |||
923 | nid = page_to_nid(page); | ||
924 | if (!node_isset(nid, node_states[N_HIGH_MEMORY])) | ||
925 | return NULL; | ||
926 | |||
927 | return page; | ||
904 | } | 928 | } |
905 | 929 | ||
906 | static int gather_pte_stats(pmd_t *pmd, unsigned long addr, | 930 | static int gather_pte_stats(pmd_t *pmd, unsigned long addr, |
@@ -912,26 +936,32 @@ static int gather_pte_stats(pmd_t *pmd, unsigned long addr, | |||
912 | pte_t *pte; | 936 | pte_t *pte; |
913 | 937 | ||
914 | md = walk->private; | 938 | md = walk->private; |
915 | orig_pte = pte = pte_offset_map_lock(walk->mm, pmd, addr, &ptl); | 939 | spin_lock(&walk->mm->page_table_lock); |
916 | do { | 940 | if (pmd_trans_huge(*pmd)) { |
917 | struct page *page; | 941 | if (pmd_trans_splitting(*pmd)) { |
918 | int nid; | 942 | spin_unlock(&walk->mm->page_table_lock); |
943 | wait_split_huge_page(md->vma->anon_vma, pmd); | ||
944 | } else { | ||
945 | pte_t huge_pte = *(pte_t *)pmd; | ||
946 | struct page *page; | ||
919 | 947 | ||
920 | if (!pte_present(*pte)) | 948 | page = can_gather_numa_stats(huge_pte, md->vma, addr); |
921 | continue; | 949 | if (page) |
950 | gather_stats(page, md, pte_dirty(huge_pte), | ||
951 | HPAGE_PMD_SIZE/PAGE_SIZE); | ||
952 | spin_unlock(&walk->mm->page_table_lock); | ||
953 | return 0; | ||
954 | } | ||
955 | } else { | ||
956 | spin_unlock(&walk->mm->page_table_lock); | ||
957 | } | ||
922 | 958 | ||
923 | page = vm_normal_page(md->vma, addr, *pte); | 959 | orig_pte = pte = pte_offset_map_lock(walk->mm, pmd, addr, &ptl); |
960 | do { | ||
961 | struct page *page = can_gather_numa_stats(*pte, md->vma, addr); | ||
924 | if (!page) | 962 | if (!page) |
925 | continue; | 963 | continue; |
926 | 964 | gather_stats(page, md, pte_dirty(*pte), 1); | |
927 | if (PageReserved(page)) | ||
928 | continue; | ||
929 | |||
930 | nid = page_to_nid(page); | ||
931 | if (!node_isset(nid, node_states[N_HIGH_MEMORY])) | ||
932 | continue; | ||
933 | |||
934 | gather_stats(page, md, pte_dirty(*pte)); | ||
935 | 965 | ||
936 | } while (pte++, addr += PAGE_SIZE, addr != end); | 966 | } while (pte++, addr += PAGE_SIZE, addr != end); |
937 | pte_unmap_unlock(orig_pte, ptl); | 967 | pte_unmap_unlock(orig_pte, ptl); |
@@ -952,7 +982,7 @@ static int gather_hugetbl_stats(pte_t *pte, unsigned long hmask, | |||
952 | return 0; | 982 | return 0; |
953 | 983 | ||
954 | md = walk->private; | 984 | md = walk->private; |
955 | gather_stats(page, md, pte_dirty(*pte)); | 985 | gather_stats(page, md, pte_dirty(*pte), 1); |
956 | return 0; | 986 | return 0; |
957 | } | 987 | } |
958 | 988 | ||
diff --git a/fs/quota/quota.c b/fs/quota/quota.c index b34bdb25490c..10b6be3ca280 100644 --- a/fs/quota/quota.c +++ b/fs/quota/quota.c | |||
@@ -355,7 +355,7 @@ SYSCALL_DEFINE4(quotactl, unsigned int, cmd, const char __user *, special, | |||
355 | * resolution (think about autofs) and thus deadlocks could arise. | 355 | * resolution (think about autofs) and thus deadlocks could arise. |
356 | */ | 356 | */ |
357 | if (cmds == Q_QUOTAON) { | 357 | if (cmds == Q_QUOTAON) { |
358 | ret = user_path_at(AT_FDCWD, addr, LOOKUP_FOLLOW, &path); | 358 | ret = user_path_at(AT_FDCWD, addr, LOOKUP_FOLLOW|LOOKUP_AUTOMOUNT, &path); |
359 | if (ret) | 359 | if (ret) |
360 | pathp = ERR_PTR(ret); | 360 | pathp = ERR_PTR(ret); |
361 | else | 361 | else |
@@ -81,8 +81,6 @@ int vfs_fstatat(int dfd, const char __user *filename, struct kstat *stat, | |||
81 | 81 | ||
82 | if (!(flag & AT_SYMLINK_NOFOLLOW)) | 82 | if (!(flag & AT_SYMLINK_NOFOLLOW)) |
83 | lookup_flags |= LOOKUP_FOLLOW; | 83 | lookup_flags |= LOOKUP_FOLLOW; |
84 | if (flag & AT_NO_AUTOMOUNT) | ||
85 | lookup_flags |= LOOKUP_NO_AUTOMOUNT; | ||
86 | if (flag & AT_EMPTY_PATH) | 84 | if (flag & AT_EMPTY_PATH) |
87 | lookup_flags |= LOOKUP_EMPTY; | 85 | lookup_flags |= LOOKUP_EMPTY; |
88 | 86 | ||
diff --git a/fs/ubifs/debug.h b/fs/ubifs/debug.h index 45174b534377..feb361e252ac 100644 --- a/fs/ubifs/debug.h +++ b/fs/ubifs/debug.h | |||
@@ -335,9 +335,9 @@ void dbg_debugfs_exit_fs(struct ubifs_info *c); | |||
335 | #define DBGKEY(key) ((char *)(key)) | 335 | #define DBGKEY(key) ((char *)(key)) |
336 | #define DBGKEY1(key) ((char *)(key)) | 336 | #define DBGKEY1(key) ((char *)(key)) |
337 | 337 | ||
338 | #define ubifs_dbg_msg(fmt, ...) do { \ | 338 | #define ubifs_dbg_msg(fmt, ...) do { \ |
339 | if (0) \ | 339 | if (0) \ |
340 | pr_debug(fmt "\n", ##__VA_ARGS__); \ | 340 | printk(KERN_DEBUG fmt "\n", ##__VA_ARGS__); \ |
341 | } while (0) | 341 | } while (0) |
342 | 342 | ||
343 | #define dbg_dump_stack() | 343 | #define dbg_dump_stack() |
diff --git a/fs/xfs/Makefile b/fs/xfs/Makefile index 75bb316529dd..427a4e82a588 100644 --- a/fs/xfs/Makefile +++ b/fs/xfs/Makefile | |||
@@ -16,44 +16,53 @@ | |||
16 | # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | 16 | # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
17 | # | 17 | # |
18 | 18 | ||
19 | ccflags-y := -I$(src) -I$(src)/linux-2.6 | 19 | ccflags-y += -I$(src) # needed for trace events |
20 | ccflags-$(CONFIG_XFS_DEBUG) += -g | ||
21 | 20 | ||
22 | XFS_LINUX := linux-2.6 | 21 | ccflags-$(CONFIG_XFS_DEBUG) += -g |
23 | 22 | ||
24 | obj-$(CONFIG_XFS_FS) += xfs.o | 23 | obj-$(CONFIG_XFS_FS) += xfs.o |
25 | 24 | ||
26 | xfs-y += linux-2.6/xfs_trace.o | 25 | # this one should be compiled first, as the tracing macros can easily blow up |
27 | 26 | xfs-y += xfs_trace.o | |
28 | xfs-$(CONFIG_XFS_QUOTA) += $(addprefix quota/, \ | ||
29 | xfs_dquot.o \ | ||
30 | xfs_dquot_item.o \ | ||
31 | xfs_trans_dquot.o \ | ||
32 | xfs_qm_syscalls.o \ | ||
33 | xfs_qm_bhv.o \ | ||
34 | xfs_qm.o) | ||
35 | xfs-$(CONFIG_XFS_QUOTA) += linux-2.6/xfs_quotaops.o | ||
36 | |||
37 | ifeq ($(CONFIG_XFS_QUOTA),y) | ||
38 | xfs-$(CONFIG_PROC_FS) += quota/xfs_qm_stats.o | ||
39 | endif | ||
40 | |||
41 | xfs-$(CONFIG_XFS_RT) += xfs_rtalloc.o | ||
42 | xfs-$(CONFIG_XFS_POSIX_ACL) += $(XFS_LINUX)/xfs_acl.o | ||
43 | xfs-$(CONFIG_PROC_FS) += $(XFS_LINUX)/xfs_stats.o | ||
44 | xfs-$(CONFIG_SYSCTL) += $(XFS_LINUX)/xfs_sysctl.o | ||
45 | xfs-$(CONFIG_COMPAT) += $(XFS_LINUX)/xfs_ioctl32.o | ||
46 | 27 | ||
28 | # highlevel code | ||
29 | xfs-y += xfs_aops.o \ | ||
30 | xfs_bit.o \ | ||
31 | xfs_buf.o \ | ||
32 | xfs_dfrag.o \ | ||
33 | xfs_discard.o \ | ||
34 | xfs_error.o \ | ||
35 | xfs_export.o \ | ||
36 | xfs_file.o \ | ||
37 | xfs_filestream.o \ | ||
38 | xfs_fsops.o \ | ||
39 | xfs_fs_subr.o \ | ||
40 | xfs_globals.o \ | ||
41 | xfs_iget.o \ | ||
42 | xfs_ioctl.o \ | ||
43 | xfs_iomap.o \ | ||
44 | xfs_iops.o \ | ||
45 | xfs_itable.o \ | ||
46 | xfs_message.o \ | ||
47 | xfs_mru_cache.o \ | ||
48 | xfs_super.o \ | ||
49 | xfs_sync.o \ | ||
50 | xfs_xattr.o \ | ||
51 | xfs_rename.o \ | ||
52 | xfs_rw.o \ | ||
53 | xfs_utils.o \ | ||
54 | xfs_vnodeops.o \ | ||
55 | kmem.o \ | ||
56 | uuid.o | ||
47 | 57 | ||
58 | # code shared with libxfs | ||
48 | xfs-y += xfs_alloc.o \ | 59 | xfs-y += xfs_alloc.o \ |
49 | xfs_alloc_btree.o \ | 60 | xfs_alloc_btree.o \ |
50 | xfs_attr.o \ | 61 | xfs_attr.o \ |
51 | xfs_attr_leaf.o \ | 62 | xfs_attr_leaf.o \ |
52 | xfs_bit.o \ | ||
53 | xfs_bmap.o \ | 63 | xfs_bmap.o \ |
54 | xfs_bmap_btree.o \ | 64 | xfs_bmap_btree.o \ |
55 | xfs_btree.o \ | 65 | xfs_btree.o \ |
56 | xfs_buf_item.o \ | ||
57 | xfs_da_btree.o \ | 66 | xfs_da_btree.o \ |
58 | xfs_dir2.o \ | 67 | xfs_dir2.o \ |
59 | xfs_dir2_block.o \ | 68 | xfs_dir2_block.o \ |
@@ -61,49 +70,37 @@ xfs-y += xfs_alloc.o \ | |||
61 | xfs_dir2_leaf.o \ | 70 | xfs_dir2_leaf.o \ |
62 | xfs_dir2_node.o \ | 71 | xfs_dir2_node.o \ |
63 | xfs_dir2_sf.o \ | 72 | xfs_dir2_sf.o \ |
64 | xfs_error.o \ | ||
65 | xfs_extfree_item.o \ | ||
66 | xfs_filestream.o \ | ||
67 | xfs_fsops.o \ | ||
68 | xfs_ialloc.o \ | 73 | xfs_ialloc.o \ |
69 | xfs_ialloc_btree.o \ | 74 | xfs_ialloc_btree.o \ |
70 | xfs_iget.o \ | ||
71 | xfs_inode.o \ | 75 | xfs_inode.o \ |
72 | xfs_inode_item.o \ | ||
73 | xfs_iomap.o \ | ||
74 | xfs_itable.o \ | ||
75 | xfs_dfrag.o \ | ||
76 | xfs_log.o \ | ||
77 | xfs_log_cil.o \ | ||
78 | xfs_log_recover.o \ | 76 | xfs_log_recover.o \ |
79 | xfs_mount.o \ | 77 | xfs_mount.o \ |
80 | xfs_mru_cache.o \ | 78 | xfs_trans.o |
81 | xfs_rename.o \ | 79 | |
82 | xfs_trans.o \ | 80 | # low-level transaction/log code |
81 | xfs-y += xfs_log.o \ | ||
82 | xfs_log_cil.o \ | ||
83 | xfs_buf_item.o \ | ||
84 | xfs_extfree_item.o \ | ||
85 | xfs_inode_item.o \ | ||
83 | xfs_trans_ail.o \ | 86 | xfs_trans_ail.o \ |
84 | xfs_trans_buf.o \ | 87 | xfs_trans_buf.o \ |
85 | xfs_trans_extfree.o \ | 88 | xfs_trans_extfree.o \ |
86 | xfs_trans_inode.o \ | 89 | xfs_trans_inode.o \ |
87 | xfs_utils.o \ | ||
88 | xfs_vnodeops.o \ | ||
89 | xfs_rw.o | ||
90 | |||
91 | # Objects in linux/ | ||
92 | xfs-y += $(addprefix $(XFS_LINUX)/, \ | ||
93 | kmem.o \ | ||
94 | xfs_aops.o \ | ||
95 | xfs_buf.o \ | ||
96 | xfs_discard.o \ | ||
97 | xfs_export.o \ | ||
98 | xfs_file.o \ | ||
99 | xfs_fs_subr.o \ | ||
100 | xfs_globals.o \ | ||
101 | xfs_ioctl.o \ | ||
102 | xfs_iops.o \ | ||
103 | xfs_message.o \ | ||
104 | xfs_super.o \ | ||
105 | xfs_sync.o \ | ||
106 | xfs_xattr.o) | ||
107 | 90 | ||
108 | # Objects in support/ | 91 | # optional features |
109 | xfs-y += support/uuid.o | 92 | xfs-$(CONFIG_XFS_QUOTA) += xfs_dquot.o \ |
93 | xfs_dquot_item.o \ | ||
94 | xfs_trans_dquot.o \ | ||
95 | xfs_qm_syscalls.o \ | ||
96 | xfs_qm_bhv.o \ | ||
97 | xfs_qm.o \ | ||
98 | xfs_quotaops.o | ||
99 | ifeq ($(CONFIG_XFS_QUOTA),y) | ||
100 | xfs-$(CONFIG_PROC_FS) += xfs_qm_stats.o | ||
101 | endif | ||
102 | xfs-$(CONFIG_XFS_RT) += xfs_rtalloc.o | ||
103 | xfs-$(CONFIG_XFS_POSIX_ACL) += xfs_acl.o | ||
104 | xfs-$(CONFIG_PROC_FS) += xfs_stats.o | ||
105 | xfs-$(CONFIG_SYSCTL) += xfs_sysctl.o | ||
106 | xfs-$(CONFIG_COMPAT) += xfs_ioctl32.o | ||
diff --git a/fs/xfs/linux-2.6/kmem.c b/fs/xfs/kmem.c index a907de565db3..a907de565db3 100644 --- a/fs/xfs/linux-2.6/kmem.c +++ b/fs/xfs/kmem.c | |||
diff --git a/fs/xfs/linux-2.6/kmem.h b/fs/xfs/kmem.h index f7c8f7a9ea6d..f7c8f7a9ea6d 100644 --- a/fs/xfs/linux-2.6/kmem.h +++ b/fs/xfs/kmem.h | |||
diff --git a/fs/xfs/linux-2.6/mrlock.h b/fs/xfs/mrlock.h index ff6a19873e5c..ff6a19873e5c 100644 --- a/fs/xfs/linux-2.6/mrlock.h +++ b/fs/xfs/mrlock.h | |||
diff --git a/fs/xfs/linux-2.6/time.h b/fs/xfs/time.h index 387e695a184c..387e695a184c 100644 --- a/fs/xfs/linux-2.6/time.h +++ b/fs/xfs/time.h | |||
diff --git a/fs/xfs/support/uuid.c b/fs/xfs/uuid.c index b83f76b6d410..b83f76b6d410 100644 --- a/fs/xfs/support/uuid.c +++ b/fs/xfs/uuid.c | |||
diff --git a/fs/xfs/support/uuid.h b/fs/xfs/uuid.h index 4732d71262cc..4732d71262cc 100644 --- a/fs/xfs/support/uuid.h +++ b/fs/xfs/uuid.h | |||
diff --git a/fs/xfs/xfs.h b/fs/xfs/xfs.h index 53ec3ea9a625..d8b11b7f94aa 100644 --- a/fs/xfs/xfs.h +++ b/fs/xfs/xfs.h | |||
@@ -24,5 +24,6 @@ | |||
24 | #define XFS_BUF_LOCK_TRACKING 1 | 24 | #define XFS_BUF_LOCK_TRACKING 1 |
25 | #endif | 25 | #endif |
26 | 26 | ||
27 | #include <linux-2.6/xfs_linux.h> | 27 | #include "xfs_linux.h" |
28 | |||
28 | #endif /* __XFS_H__ */ | 29 | #endif /* __XFS_H__ */ |
diff --git a/fs/xfs/linux-2.6/xfs_acl.c b/fs/xfs/xfs_acl.c index b6c4b3795c4a..b6c4b3795c4a 100644 --- a/fs/xfs/linux-2.6/xfs_acl.c +++ b/fs/xfs/xfs_acl.c | |||
diff --git a/fs/xfs/linux-2.6/xfs_aops.c b/fs/xfs/xfs_aops.c index 63e971e2b837..8c37dde4c521 100644 --- a/fs/xfs/linux-2.6/xfs_aops.c +++ b/fs/xfs/xfs_aops.c | |||
@@ -1300,6 +1300,7 @@ xfs_end_io_direct_write( | |||
1300 | bool is_async) | 1300 | bool is_async) |
1301 | { | 1301 | { |
1302 | struct xfs_ioend *ioend = iocb->private; | 1302 | struct xfs_ioend *ioend = iocb->private; |
1303 | struct inode *inode = ioend->io_inode; | ||
1303 | 1304 | ||
1304 | /* | 1305 | /* |
1305 | * blockdev_direct_IO can return an error even after the I/O | 1306 | * blockdev_direct_IO can return an error even after the I/O |
@@ -1331,7 +1332,7 @@ xfs_end_io_direct_write( | |||
1331 | } | 1332 | } |
1332 | 1333 | ||
1333 | /* XXX: probably should move into the real I/O completion handler */ | 1334 | /* XXX: probably should move into the real I/O completion handler */ |
1334 | inode_dio_done(ioend->io_inode); | 1335 | inode_dio_done(inode); |
1335 | } | 1336 | } |
1336 | 1337 | ||
1337 | STATIC ssize_t | 1338 | STATIC ssize_t |
diff --git a/fs/xfs/linux-2.6/xfs_aops.h b/fs/xfs/xfs_aops.h index 71f721e1a71f..71f721e1a71f 100644 --- a/fs/xfs/linux-2.6/xfs_aops.h +++ b/fs/xfs/xfs_aops.h | |||
diff --git a/fs/xfs/linux-2.6/xfs_buf.c b/fs/xfs/xfs_buf.c index c57836dc778f..c57836dc778f 100644 --- a/fs/xfs/linux-2.6/xfs_buf.c +++ b/fs/xfs/xfs_buf.c | |||
diff --git a/fs/xfs/linux-2.6/xfs_buf.h b/fs/xfs/xfs_buf.h index 620972b8094d..620972b8094d 100644 --- a/fs/xfs/linux-2.6/xfs_buf.h +++ b/fs/xfs/xfs_buf.h | |||
diff --git a/fs/xfs/linux-2.6/xfs_discard.c b/fs/xfs/xfs_discard.c index 244e797dae32..244e797dae32 100644 --- a/fs/xfs/linux-2.6/xfs_discard.c +++ b/fs/xfs/xfs_discard.c | |||
diff --git a/fs/xfs/linux-2.6/xfs_discard.h b/fs/xfs/xfs_discard.h index 344879aea646..344879aea646 100644 --- a/fs/xfs/linux-2.6/xfs_discard.h +++ b/fs/xfs/xfs_discard.h | |||
diff --git a/fs/xfs/quota/xfs_dquot.c b/fs/xfs/xfs_dquot.c index db62959bed13..db62959bed13 100644 --- a/fs/xfs/quota/xfs_dquot.c +++ b/fs/xfs/xfs_dquot.c | |||
diff --git a/fs/xfs/quota/xfs_dquot.h b/fs/xfs/xfs_dquot.h index 34b7e945dbfa..34b7e945dbfa 100644 --- a/fs/xfs/quota/xfs_dquot.h +++ b/fs/xfs/xfs_dquot.h | |||
diff --git a/fs/xfs/quota/xfs_dquot_item.c b/fs/xfs/xfs_dquot_item.c index 9e0e2fa3f2c8..9e0e2fa3f2c8 100644 --- a/fs/xfs/quota/xfs_dquot_item.c +++ b/fs/xfs/xfs_dquot_item.c | |||
diff --git a/fs/xfs/quota/xfs_dquot_item.h b/fs/xfs/xfs_dquot_item.h index 5acae2ada70b..5acae2ada70b 100644 --- a/fs/xfs/quota/xfs_dquot_item.h +++ b/fs/xfs/xfs_dquot_item.h | |||
diff --git a/fs/xfs/linux-2.6/xfs_export.c b/fs/xfs/xfs_export.c index 75e5d322e48f..75e5d322e48f 100644 --- a/fs/xfs/linux-2.6/xfs_export.c +++ b/fs/xfs/xfs_export.c | |||
diff --git a/fs/xfs/linux-2.6/xfs_export.h b/fs/xfs/xfs_export.h index 3272b6ae7a35..3272b6ae7a35 100644 --- a/fs/xfs/linux-2.6/xfs_export.h +++ b/fs/xfs/xfs_export.h | |||
diff --git a/fs/xfs/linux-2.6/xfs_file.c b/fs/xfs/xfs_file.c index 7f7b42469ea7..7f7b42469ea7 100644 --- a/fs/xfs/linux-2.6/xfs_file.c +++ b/fs/xfs/xfs_file.c | |||
diff --git a/fs/xfs/linux-2.6/xfs_fs_subr.c b/fs/xfs/xfs_fs_subr.c index ed88ed16811c..ed88ed16811c 100644 --- a/fs/xfs/linux-2.6/xfs_fs_subr.c +++ b/fs/xfs/xfs_fs_subr.c | |||
diff --git a/fs/xfs/linux-2.6/xfs_globals.c b/fs/xfs/xfs_globals.c index 76e81cff70b9..76e81cff70b9 100644 --- a/fs/xfs/linux-2.6/xfs_globals.c +++ b/fs/xfs/xfs_globals.c | |||
diff --git a/fs/xfs/linux-2.6/xfs_ioctl.c b/fs/xfs/xfs_ioctl.c index f7ce7debe14c..f7ce7debe14c 100644 --- a/fs/xfs/linux-2.6/xfs_ioctl.c +++ b/fs/xfs/xfs_ioctl.c | |||
diff --git a/fs/xfs/linux-2.6/xfs_ioctl.h b/fs/xfs/xfs_ioctl.h index d56173b34a2a..d56173b34a2a 100644 --- a/fs/xfs/linux-2.6/xfs_ioctl.h +++ b/fs/xfs/xfs_ioctl.h | |||
diff --git a/fs/xfs/linux-2.6/xfs_ioctl32.c b/fs/xfs/xfs_ioctl32.c index 54e623bfbb85..54e623bfbb85 100644 --- a/fs/xfs/linux-2.6/xfs_ioctl32.c +++ b/fs/xfs/xfs_ioctl32.c | |||
diff --git a/fs/xfs/linux-2.6/xfs_ioctl32.h b/fs/xfs/xfs_ioctl32.h index 80f4060e8970..80f4060e8970 100644 --- a/fs/xfs/linux-2.6/xfs_ioctl32.h +++ b/fs/xfs/xfs_ioctl32.h | |||
diff --git a/fs/xfs/linux-2.6/xfs_iops.c b/fs/xfs/xfs_iops.c index b9c172b3fbbe..673704fab748 100644 --- a/fs/xfs/linux-2.6/xfs_iops.c +++ b/fs/xfs/xfs_iops.c | |||
@@ -70,9 +70,8 @@ xfs_synchronize_times( | |||
70 | } | 70 | } |
71 | 71 | ||
72 | /* | 72 | /* |
73 | * If the linux inode is valid, mark it dirty. | 73 | * If the linux inode is valid, mark it dirty, else mark the dirty state |
74 | * Used when committing a dirty inode into a transaction so that | 74 | * in the XFS inode to make sure we pick it up when reclaiming the inode. |
75 | * the inode will get written back by the linux code | ||
76 | */ | 75 | */ |
77 | void | 76 | void |
78 | xfs_mark_inode_dirty_sync( | 77 | xfs_mark_inode_dirty_sync( |
@@ -82,6 +81,10 @@ xfs_mark_inode_dirty_sync( | |||
82 | 81 | ||
83 | if (!(inode->i_state & (I_WILL_FREE|I_FREEING))) | 82 | if (!(inode->i_state & (I_WILL_FREE|I_FREEING))) |
84 | mark_inode_dirty_sync(inode); | 83 | mark_inode_dirty_sync(inode); |
84 | else { | ||
85 | barrier(); | ||
86 | ip->i_update_core = 1; | ||
87 | } | ||
85 | } | 88 | } |
86 | 89 | ||
87 | void | 90 | void |
@@ -92,6 +95,11 @@ xfs_mark_inode_dirty( | |||
92 | 95 | ||
93 | if (!(inode->i_state & (I_WILL_FREE|I_FREEING))) | 96 | if (!(inode->i_state & (I_WILL_FREE|I_FREEING))) |
94 | mark_inode_dirty(inode); | 97 | mark_inode_dirty(inode); |
98 | else { | ||
99 | barrier(); | ||
100 | ip->i_update_core = 1; | ||
101 | } | ||
102 | |||
95 | } | 103 | } |
96 | 104 | ||
97 | /* | 105 | /* |
diff --git a/fs/xfs/linux-2.6/xfs_iops.h b/fs/xfs/xfs_iops.h index ef41c92ce66e..ef41c92ce66e 100644 --- a/fs/xfs/linux-2.6/xfs_iops.h +++ b/fs/xfs/xfs_iops.h | |||
diff --git a/fs/xfs/linux-2.6/xfs_linux.h b/fs/xfs/xfs_linux.h index d42f814e4d35..1e8a45e74c3e 100644 --- a/fs/xfs/linux-2.6/xfs_linux.h +++ b/fs/xfs/xfs_linux.h | |||
@@ -32,13 +32,12 @@ | |||
32 | # define XFS_BIG_INUMS 0 | 32 | # define XFS_BIG_INUMS 0 |
33 | #endif | 33 | #endif |
34 | 34 | ||
35 | #include <xfs_types.h> | 35 | #include "xfs_types.h" |
36 | 36 | ||
37 | #include <kmem.h> | 37 | #include "kmem.h" |
38 | #include <mrlock.h> | 38 | #include "mrlock.h" |
39 | #include <time.h> | 39 | #include "time.h" |
40 | 40 | #include "uuid.h" | |
41 | #include <support/uuid.h> | ||
42 | 41 | ||
43 | #include <linux/semaphore.h> | 42 | #include <linux/semaphore.h> |
44 | #include <linux/mm.h> | 43 | #include <linux/mm.h> |
@@ -78,14 +77,14 @@ | |||
78 | #include <asm/byteorder.h> | 77 | #include <asm/byteorder.h> |
79 | #include <asm/unaligned.h> | 78 | #include <asm/unaligned.h> |
80 | 79 | ||
81 | #include <xfs_vnode.h> | 80 | #include "xfs_vnode.h" |
82 | #include <xfs_stats.h> | 81 | #include "xfs_stats.h" |
83 | #include <xfs_sysctl.h> | 82 | #include "xfs_sysctl.h" |
84 | #include <xfs_iops.h> | 83 | #include "xfs_iops.h" |
85 | #include <xfs_aops.h> | 84 | #include "xfs_aops.h" |
86 | #include <xfs_super.h> | 85 | #include "xfs_super.h" |
87 | #include <xfs_buf.h> | 86 | #include "xfs_buf.h" |
88 | #include <xfs_message.h> | 87 | #include "xfs_message.h" |
89 | 88 | ||
90 | #ifdef __BIG_ENDIAN | 89 | #ifdef __BIG_ENDIAN |
91 | #define XFS_NATIVE_HOST 1 | 90 | #define XFS_NATIVE_HOST 1 |
diff --git a/fs/xfs/linux-2.6/xfs_message.c b/fs/xfs/xfs_message.c index bd672def95ac..bd672def95ac 100644 --- a/fs/xfs/linux-2.6/xfs_message.c +++ b/fs/xfs/xfs_message.c | |||
diff --git a/fs/xfs/linux-2.6/xfs_message.h b/fs/xfs/xfs_message.h index 7fb7ea007672..7fb7ea007672 100644 --- a/fs/xfs/linux-2.6/xfs_message.h +++ b/fs/xfs/xfs_message.h | |||
diff --git a/fs/xfs/quota/xfs_qm.c b/fs/xfs/xfs_qm.c index 9a0aa76facdf..9a0aa76facdf 100644 --- a/fs/xfs/quota/xfs_qm.c +++ b/fs/xfs/xfs_qm.c | |||
diff --git a/fs/xfs/quota/xfs_qm.h b/fs/xfs/xfs_qm.h index 43b9abe1052c..43b9abe1052c 100644 --- a/fs/xfs/quota/xfs_qm.h +++ b/fs/xfs/xfs_qm.h | |||
diff --git a/fs/xfs/quota/xfs_qm_bhv.c b/fs/xfs/xfs_qm_bhv.c index a0a829addca9..a0a829addca9 100644 --- a/fs/xfs/quota/xfs_qm_bhv.c +++ b/fs/xfs/xfs_qm_bhv.c | |||
diff --git a/fs/xfs/quota/xfs_qm_stats.c b/fs/xfs/xfs_qm_stats.c index 8671a0b32644..8671a0b32644 100644 --- a/fs/xfs/quota/xfs_qm_stats.c +++ b/fs/xfs/xfs_qm_stats.c | |||
diff --git a/fs/xfs/quota/xfs_qm_stats.h b/fs/xfs/xfs_qm_stats.h index 5b964fc0dc09..5b964fc0dc09 100644 --- a/fs/xfs/quota/xfs_qm_stats.h +++ b/fs/xfs/xfs_qm_stats.h | |||
diff --git a/fs/xfs/quota/xfs_qm_syscalls.c b/fs/xfs/xfs_qm_syscalls.c index 609246f42e6c..609246f42e6c 100644 --- a/fs/xfs/quota/xfs_qm_syscalls.c +++ b/fs/xfs/xfs_qm_syscalls.c | |||
diff --git a/fs/xfs/quota/xfs_quota_priv.h b/fs/xfs/xfs_quota_priv.h index 94a3d927d716..94a3d927d716 100644 --- a/fs/xfs/quota/xfs_quota_priv.h +++ b/fs/xfs/xfs_quota_priv.h | |||
diff --git a/fs/xfs/linux-2.6/xfs_quotaops.c b/fs/xfs/xfs_quotaops.c index 29b9d642e93d..7e76f537abb7 100644 --- a/fs/xfs/linux-2.6/xfs_quotaops.c +++ b/fs/xfs/xfs_quotaops.c | |||
@@ -25,7 +25,7 @@ | |||
25 | #include "xfs_trans.h" | 25 | #include "xfs_trans.h" |
26 | #include "xfs_bmap_btree.h" | 26 | #include "xfs_bmap_btree.h" |
27 | #include "xfs_inode.h" | 27 | #include "xfs_inode.h" |
28 | #include "quota/xfs_qm.h" | 28 | #include "xfs_qm.h" |
29 | #include <linux/quota.h> | 29 | #include <linux/quota.h> |
30 | 30 | ||
31 | 31 | ||
diff --git a/fs/xfs/linux-2.6/xfs_stats.c b/fs/xfs/xfs_stats.c index 76fdc5861932..76fdc5861932 100644 --- a/fs/xfs/linux-2.6/xfs_stats.c +++ b/fs/xfs/xfs_stats.c | |||
diff --git a/fs/xfs/linux-2.6/xfs_stats.h b/fs/xfs/xfs_stats.h index 736854b1ca1a..736854b1ca1a 100644 --- a/fs/xfs/linux-2.6/xfs_stats.h +++ b/fs/xfs/xfs_stats.h | |||
diff --git a/fs/xfs/linux-2.6/xfs_super.c b/fs/xfs/xfs_super.c index 9a72dda58bd0..2366c54cc4fa 100644 --- a/fs/xfs/linux-2.6/xfs_super.c +++ b/fs/xfs/xfs_super.c | |||
@@ -356,6 +356,8 @@ xfs_parseargs( | |||
356 | mp->m_flags |= XFS_MOUNT_DELAYLOG; | 356 | mp->m_flags |= XFS_MOUNT_DELAYLOG; |
357 | } else if (!strcmp(this_char, MNTOPT_NODELAYLOG)) { | 357 | } else if (!strcmp(this_char, MNTOPT_NODELAYLOG)) { |
358 | mp->m_flags &= ~XFS_MOUNT_DELAYLOG; | 358 | mp->m_flags &= ~XFS_MOUNT_DELAYLOG; |
359 | xfs_warn(mp, | ||
360 | "nodelaylog is deprecated and will be removed in Linux 3.3"); | ||
359 | } else if (!strcmp(this_char, MNTOPT_DISCARD)) { | 361 | } else if (!strcmp(this_char, MNTOPT_DISCARD)) { |
360 | mp->m_flags |= XFS_MOUNT_DISCARD; | 362 | mp->m_flags |= XFS_MOUNT_DISCARD; |
361 | } else if (!strcmp(this_char, MNTOPT_NODISCARD)) { | 363 | } else if (!strcmp(this_char, MNTOPT_NODISCARD)) { |
@@ -877,33 +879,17 @@ xfs_log_inode( | |||
877 | struct xfs_trans *tp; | 879 | struct xfs_trans *tp; |
878 | int error; | 880 | int error; |
879 | 881 | ||
880 | xfs_iunlock(ip, XFS_ILOCK_SHARED); | ||
881 | tp = xfs_trans_alloc(mp, XFS_TRANS_FSYNC_TS); | 882 | tp = xfs_trans_alloc(mp, XFS_TRANS_FSYNC_TS); |
882 | error = xfs_trans_reserve(tp, 0, XFS_FSYNC_TS_LOG_RES(mp), 0, 0, 0); | 883 | error = xfs_trans_reserve(tp, 0, XFS_FSYNC_TS_LOG_RES(mp), 0, 0, 0); |
883 | |||
884 | if (error) { | 884 | if (error) { |
885 | xfs_trans_cancel(tp, 0); | 885 | xfs_trans_cancel(tp, 0); |
886 | /* we need to return with the lock hold shared */ | ||
887 | xfs_ilock(ip, XFS_ILOCK_SHARED); | ||
888 | return error; | 886 | return error; |
889 | } | 887 | } |
890 | 888 | ||
891 | xfs_ilock(ip, XFS_ILOCK_EXCL); | 889 | xfs_ilock(ip, XFS_ILOCK_EXCL); |
892 | 890 | xfs_trans_ijoin_ref(tp, ip, XFS_ILOCK_EXCL); | |
893 | /* | ||
894 | * Note - it's possible that we might have pushed ourselves out of the | ||
895 | * way during trans_reserve which would flush the inode. But there's | ||
896 | * no guarantee that the inode buffer has actually gone out yet (it's | ||
897 | * delwri). Plus the buffer could be pinned anyway if it's part of | ||
898 | * an inode in another recent transaction. So we play it safe and | ||
899 | * fire off the transaction anyway. | ||
900 | */ | ||
901 | xfs_trans_ijoin(tp, ip); | ||
902 | xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE); | 891 | xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE); |
903 | error = xfs_trans_commit(tp, 0); | 892 | return xfs_trans_commit(tp, 0); |
904 | xfs_ilock_demote(ip, XFS_ILOCK_EXCL); | ||
905 | |||
906 | return error; | ||
907 | } | 893 | } |
908 | 894 | ||
909 | STATIC int | 895 | STATIC int |
@@ -918,7 +904,9 @@ xfs_fs_write_inode( | |||
918 | trace_xfs_write_inode(ip); | 904 | trace_xfs_write_inode(ip); |
919 | 905 | ||
920 | if (XFS_FORCED_SHUTDOWN(mp)) | 906 | if (XFS_FORCED_SHUTDOWN(mp)) |
921 | return XFS_ERROR(EIO); | 907 | return -XFS_ERROR(EIO); |
908 | if (!ip->i_update_core) | ||
909 | return 0; | ||
922 | 910 | ||
923 | if (wbc->sync_mode == WB_SYNC_ALL) { | 911 | if (wbc->sync_mode == WB_SYNC_ALL) { |
924 | /* | 912 | /* |
@@ -929,12 +917,10 @@ xfs_fs_write_inode( | |||
929 | * of synchronous log foces dramatically. | 917 | * of synchronous log foces dramatically. |
930 | */ | 918 | */ |
931 | xfs_ioend_wait(ip); | 919 | xfs_ioend_wait(ip); |
932 | xfs_ilock(ip, XFS_ILOCK_SHARED); | 920 | error = xfs_log_inode(ip); |
933 | if (ip->i_update_core) { | 921 | if (error) |
934 | error = xfs_log_inode(ip); | 922 | goto out; |
935 | if (error) | 923 | return 0; |
936 | goto out_unlock; | ||
937 | } | ||
938 | } else { | 924 | } else { |
939 | /* | 925 | /* |
940 | * We make this non-blocking if the inode is contended, return | 926 | * We make this non-blocking if the inode is contended, return |
diff --git a/fs/xfs/linux-2.6/xfs_super.h b/fs/xfs/xfs_super.h index 50a3266c999e..50a3266c999e 100644 --- a/fs/xfs/linux-2.6/xfs_super.h +++ b/fs/xfs/xfs_super.h | |||
diff --git a/fs/xfs/linux-2.6/xfs_sync.c b/fs/xfs/xfs_sync.c index 4604f90f86a3..4604f90f86a3 100644 --- a/fs/xfs/linux-2.6/xfs_sync.c +++ b/fs/xfs/xfs_sync.c | |||
diff --git a/fs/xfs/linux-2.6/xfs_sync.h b/fs/xfs/xfs_sync.h index 941202e7ac6e..941202e7ac6e 100644 --- a/fs/xfs/linux-2.6/xfs_sync.h +++ b/fs/xfs/xfs_sync.h | |||
diff --git a/fs/xfs/linux-2.6/xfs_sysctl.c b/fs/xfs/xfs_sysctl.c index ee2d2adaa438..ee2d2adaa438 100644 --- a/fs/xfs/linux-2.6/xfs_sysctl.c +++ b/fs/xfs/xfs_sysctl.c | |||
diff --git a/fs/xfs/linux-2.6/xfs_sysctl.h b/fs/xfs/xfs_sysctl.h index b9937d450f8e..b9937d450f8e 100644 --- a/fs/xfs/linux-2.6/xfs_sysctl.h +++ b/fs/xfs/xfs_sysctl.h | |||
diff --git a/fs/xfs/linux-2.6/xfs_trace.c b/fs/xfs/xfs_trace.c index 88d25d4aa56e..9010ce885e6a 100644 --- a/fs/xfs/linux-2.6/xfs_trace.c +++ b/fs/xfs/xfs_trace.c | |||
@@ -43,8 +43,8 @@ | |||
43 | #include "xfs_quota.h" | 43 | #include "xfs_quota.h" |
44 | #include "xfs_iomap.h" | 44 | #include "xfs_iomap.h" |
45 | #include "xfs_aops.h" | 45 | #include "xfs_aops.h" |
46 | #include "quota/xfs_dquot_item.h" | 46 | #include "xfs_dquot_item.h" |
47 | #include "quota/xfs_dquot.h" | 47 | #include "xfs_dquot.h" |
48 | #include "xfs_log_recover.h" | 48 | #include "xfs_log_recover.h" |
49 | #include "xfs_inode_item.h" | 49 | #include "xfs_inode_item.h" |
50 | 50 | ||
diff --git a/fs/xfs/linux-2.6/xfs_trace.h b/fs/xfs/xfs_trace.h index 690fc7a7bd72..690fc7a7bd72 100644 --- a/fs/xfs/linux-2.6/xfs_trace.h +++ b/fs/xfs/xfs_trace.h | |||
diff --git a/fs/xfs/quota/xfs_trans_dquot.c b/fs/xfs/xfs_trans_dquot.c index 4d00ee67792d..4d00ee67792d 100644 --- a/fs/xfs/quota/xfs_trans_dquot.c +++ b/fs/xfs/xfs_trans_dquot.c | |||
diff --git a/fs/xfs/linux-2.6/xfs_vnode.h b/fs/xfs/xfs_vnode.h index 7c220b4227bc..7c220b4227bc 100644 --- a/fs/xfs/linux-2.6/xfs_vnode.h +++ b/fs/xfs/xfs_vnode.h | |||
diff --git a/fs/xfs/linux-2.6/xfs_xattr.c b/fs/xfs/xfs_xattr.c index 87d3e03878c8..87d3e03878c8 100644 --- a/fs/xfs/linux-2.6/xfs_xattr.c +++ b/fs/xfs/xfs_xattr.c | |||