aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
Diffstat (limited to 'fs')
-rw-r--r--fs/9p/vfs_dir.c1
-rw-r--r--fs/buffer.c6
-rw-r--r--fs/direct-io.c21
-rw-r--r--fs/ext2/dir.c28
-rw-r--r--fs/namespace.c5
-rw-r--r--fs/nfsctl.c4
6 files changed, 31 insertions, 34 deletions
diff --git a/fs/9p/vfs_dir.c b/fs/9p/vfs_dir.c
index ae6d032b9b59..cd5eeb032d64 100644
--- a/fs/9p/vfs_dir.c
+++ b/fs/9p/vfs_dir.c
@@ -202,7 +202,6 @@ int v9fs_dir_release(struct inode *inode, struct file *filp)
202 filp->private_data = NULL; 202 filp->private_data = NULL;
203 } 203 }
204 204
205 d_drop(filp->f_dentry);
206 return 0; 205 return 0;
207} 206}
208 207
diff --git a/fs/buffer.c b/fs/buffer.c
index 62cfd17dc5fe..a9b399402007 100644
--- a/fs/buffer.c
+++ b/fs/buffer.c
@@ -3060,6 +3060,7 @@ int buffer_migrate_page(struct page *newpage, struct page *page)
3060{ 3060{
3061 struct address_space *mapping = page->mapping; 3061 struct address_space *mapping = page->mapping;
3062 struct buffer_head *bh, *head; 3062 struct buffer_head *bh, *head;
3063 int rc;
3063 3064
3064 if (!mapping) 3065 if (!mapping)
3065 return -EAGAIN; 3066 return -EAGAIN;
@@ -3069,8 +3070,9 @@ int buffer_migrate_page(struct page *newpage, struct page *page)
3069 3070
3070 head = page_buffers(page); 3071 head = page_buffers(page);
3071 3072
3072 if (migrate_page_remove_references(newpage, page, 3)) 3073 rc = migrate_page_remove_references(newpage, page, 3);
3073 return -EAGAIN; 3074 if (rc)
3075 return rc;
3074 3076
3075 bh = head; 3077 bh = head;
3076 do { 3078 do {
diff --git a/fs/direct-io.c b/fs/direct-io.c
index 848044af7e16..27f3e787faca 100644
--- a/fs/direct-io.c
+++ b/fs/direct-io.c
@@ -1155,15 +1155,16 @@ direct_io_worker(int rw, struct kiocb *iocb, struct inode *inode,
1155 * For writes, i_mutex is not held on entry; it is never taken. 1155 * For writes, i_mutex is not held on entry; it is never taken.
1156 * 1156 *
1157 * DIO_LOCKING (simple locking for regular files) 1157 * DIO_LOCKING (simple locking for regular files)
1158 * For writes we are called under i_mutex and return with i_mutex held, even though 1158 * For writes we are called under i_mutex and return with i_mutex held, even
1159 * it is internally dropped. 1159 * though it is internally dropped.
1160 * For reads, i_mutex is not held on entry, but it is taken and dropped before 1160 * For reads, i_mutex is not held on entry, but it is taken and dropped before
1161 * returning. 1161 * returning.
1162 * 1162 *
1163 * DIO_OWN_LOCKING (filesystem provides synchronisation and handling of 1163 * DIO_OWN_LOCKING (filesystem provides synchronisation and handling of
1164 * uninitialised data, allowing parallel direct readers and writers) 1164 * uninitialised data, allowing parallel direct readers and writers)
1165 * For writes we are called without i_mutex, return without it, never touch it. 1165 * For writes we are called without i_mutex, return without it, never touch it.
1166 * For reads, i_mutex is held on entry and will be released before returning. 1166 * For reads we are called under i_mutex and return with i_mutex held, even
1167 * though it may be internally dropped.
1167 * 1168 *
1168 * Additional i_alloc_sem locking requirements described inline below. 1169 * Additional i_alloc_sem locking requirements described inline below.
1169 */ 1170 */
@@ -1182,7 +1183,8 @@ __blockdev_direct_IO(int rw, struct kiocb *iocb, struct inode *inode,
1182 ssize_t retval = -EINVAL; 1183 ssize_t retval = -EINVAL;
1183 loff_t end = offset; 1184 loff_t end = offset;
1184 struct dio *dio; 1185 struct dio *dio;
1185 int reader_with_isem = (rw == READ && dio_lock_type == DIO_OWN_LOCKING); 1186 int release_i_mutex = 0;
1187 int acquire_i_mutex = 0;
1186 1188
1187 if (rw & WRITE) 1189 if (rw & WRITE)
1188 current->flags |= PF_SYNCWRITE; 1190 current->flags |= PF_SYNCWRITE;
@@ -1225,7 +1227,6 @@ __blockdev_direct_IO(int rw, struct kiocb *iocb, struct inode *inode,
1225 * writers need to grab i_alloc_sem only (i_mutex is already held) 1227 * writers need to grab i_alloc_sem only (i_mutex is already held)
1226 * For regular files using DIO_OWN_LOCKING, 1228 * For regular files using DIO_OWN_LOCKING,
1227 * neither readers nor writers take any locks here 1229 * neither readers nor writers take any locks here
1228 * (i_mutex is already held and release for writers here)
1229 */ 1230 */
1230 dio->lock_type = dio_lock_type; 1231 dio->lock_type = dio_lock_type;
1231 if (dio_lock_type != DIO_NO_LOCKING) { 1232 if (dio_lock_type != DIO_NO_LOCKING) {
@@ -1236,7 +1237,7 @@ __blockdev_direct_IO(int rw, struct kiocb *iocb, struct inode *inode,
1236 mapping = iocb->ki_filp->f_mapping; 1237 mapping = iocb->ki_filp->f_mapping;
1237 if (dio_lock_type != DIO_OWN_LOCKING) { 1238 if (dio_lock_type != DIO_OWN_LOCKING) {
1238 mutex_lock(&inode->i_mutex); 1239 mutex_lock(&inode->i_mutex);
1239 reader_with_isem = 1; 1240 release_i_mutex = 1;
1240 } 1241 }
1241 1242
1242 retval = filemap_write_and_wait_range(mapping, offset, 1243 retval = filemap_write_and_wait_range(mapping, offset,
@@ -1248,7 +1249,7 @@ __blockdev_direct_IO(int rw, struct kiocb *iocb, struct inode *inode,
1248 1249
1249 if (dio_lock_type == DIO_OWN_LOCKING) { 1250 if (dio_lock_type == DIO_OWN_LOCKING) {
1250 mutex_unlock(&inode->i_mutex); 1251 mutex_unlock(&inode->i_mutex);
1251 reader_with_isem = 0; 1252 acquire_i_mutex = 1;
1252 } 1253 }
1253 } 1254 }
1254 1255
@@ -1269,11 +1270,13 @@ __blockdev_direct_IO(int rw, struct kiocb *iocb, struct inode *inode,
1269 nr_segs, blkbits, get_blocks, end_io, dio); 1270 nr_segs, blkbits, get_blocks, end_io, dio);
1270 1271
1271 if (rw == READ && dio_lock_type == DIO_LOCKING) 1272 if (rw == READ && dio_lock_type == DIO_LOCKING)
1272 reader_with_isem = 0; 1273 release_i_mutex = 0;
1273 1274
1274out: 1275out:
1275 if (reader_with_isem) 1276 if (release_i_mutex)
1276 mutex_unlock(&inode->i_mutex); 1277 mutex_unlock(&inode->i_mutex);
1278 else if (acquire_i_mutex)
1279 mutex_lock(&inode->i_mutex);
1277 if (rw & WRITE) 1280 if (rw & WRITE)
1278 current->flags &= ~PF_SYNCWRITE; 1281 current->flags &= ~PF_SYNCWRITE;
1279 return retval; 1282 return retval;
diff --git a/fs/ext2/dir.c b/fs/ext2/dir.c
index 7442bdd1267a..b3dbd716cd3a 100644
--- a/fs/ext2/dir.c
+++ b/fs/ext2/dir.c
@@ -256,11 +256,10 @@ ext2_readdir (struct file * filp, void * dirent, filldir_t filldir)
256 unsigned long npages = dir_pages(inode); 256 unsigned long npages = dir_pages(inode);
257 unsigned chunk_mask = ~(ext2_chunk_size(inode)-1); 257 unsigned chunk_mask = ~(ext2_chunk_size(inode)-1);
258 unsigned char *types = NULL; 258 unsigned char *types = NULL;
259 int need_revalidate = (filp->f_version != inode->i_version); 259 int need_revalidate = filp->f_version != inode->i_version;
260 int ret;
261 260
262 if (pos > inode->i_size - EXT2_DIR_REC_LEN(1)) 261 if (pos > inode->i_size - EXT2_DIR_REC_LEN(1))
263 goto success; 262 return 0;
264 263
265 if (EXT2_HAS_INCOMPAT_FEATURE(sb, EXT2_FEATURE_INCOMPAT_FILETYPE)) 264 if (EXT2_HAS_INCOMPAT_FEATURE(sb, EXT2_FEATURE_INCOMPAT_FILETYPE))
266 types = ext2_filetype_table; 265 types = ext2_filetype_table;
@@ -275,12 +274,15 @@ ext2_readdir (struct file * filp, void * dirent, filldir_t filldir)
275 "bad page in #%lu", 274 "bad page in #%lu",
276 inode->i_ino); 275 inode->i_ino);
277 filp->f_pos += PAGE_CACHE_SIZE - offset; 276 filp->f_pos += PAGE_CACHE_SIZE - offset;
278 ret = -EIO; 277 return -EIO;
279 goto done;
280 } 278 }
281 kaddr = page_address(page); 279 kaddr = page_address(page);
282 if (need_revalidate) { 280 if (unlikely(need_revalidate)) {
283 offset = ext2_validate_entry(kaddr, offset, chunk_mask); 281 if (offset) {
282 offset = ext2_validate_entry(kaddr, offset, chunk_mask);
283 filp->f_pos = (n<<PAGE_CACHE_SHIFT) + offset;
284 }
285 filp->f_version = inode->i_version;
284 need_revalidate = 0; 286 need_revalidate = 0;
285 } 287 }
286 de = (ext2_dirent *)(kaddr+offset); 288 de = (ext2_dirent *)(kaddr+offset);
@@ -289,9 +291,8 @@ ext2_readdir (struct file * filp, void * dirent, filldir_t filldir)
289 if (de->rec_len == 0) { 291 if (de->rec_len == 0) {
290 ext2_error(sb, __FUNCTION__, 292 ext2_error(sb, __FUNCTION__,
291 "zero-length directory entry"); 293 "zero-length directory entry");
292 ret = -EIO;
293 ext2_put_page(page); 294 ext2_put_page(page);
294 goto done; 295 return -EIO;
295 } 296 }
296 if (de->inode) { 297 if (de->inode) {
297 int over; 298 int over;
@@ -306,19 +307,14 @@ ext2_readdir (struct file * filp, void * dirent, filldir_t filldir)
306 le32_to_cpu(de->inode), d_type); 307 le32_to_cpu(de->inode), d_type);
307 if (over) { 308 if (over) {
308 ext2_put_page(page); 309 ext2_put_page(page);
309 goto success; 310 return 0;
310 } 311 }
311 } 312 }
312 filp->f_pos += le16_to_cpu(de->rec_len); 313 filp->f_pos += le16_to_cpu(de->rec_len);
313 } 314 }
314 ext2_put_page(page); 315 ext2_put_page(page);
315 } 316 }
316 317 return 0;
317success:
318 ret = 0;
319done:
320 filp->f_version = inode->i_version;
321 return ret;
322} 318}
323 319
324/* 320/*
diff --git a/fs/namespace.c b/fs/namespace.c
index 058a44865beb..39c81a8d6316 100644
--- a/fs/namespace.c
+++ b/fs/namespace.c
@@ -1338,7 +1338,7 @@ struct namespace *dup_namespace(struct task_struct *tsk, struct fs_struct *fs)
1338 1338
1339 new_ns = kmalloc(sizeof(struct namespace), GFP_KERNEL); 1339 new_ns = kmalloc(sizeof(struct namespace), GFP_KERNEL);
1340 if (!new_ns) 1340 if (!new_ns)
1341 goto out; 1341 return NULL;
1342 1342
1343 atomic_set(&new_ns->count, 1); 1343 atomic_set(&new_ns->count, 1);
1344 INIT_LIST_HEAD(&new_ns->list); 1344 INIT_LIST_HEAD(&new_ns->list);
@@ -1352,7 +1352,7 @@ struct namespace *dup_namespace(struct task_struct *tsk, struct fs_struct *fs)
1352 if (!new_ns->root) { 1352 if (!new_ns->root) {
1353 up_write(&namespace_sem); 1353 up_write(&namespace_sem);
1354 kfree(new_ns); 1354 kfree(new_ns);
1355 goto out; 1355 return NULL;
1356 } 1356 }
1357 spin_lock(&vfsmount_lock); 1357 spin_lock(&vfsmount_lock);
1358 list_add_tail(&new_ns->list, &new_ns->root->mnt_list); 1358 list_add_tail(&new_ns->list, &new_ns->root->mnt_list);
@@ -1393,7 +1393,6 @@ struct namespace *dup_namespace(struct task_struct *tsk, struct fs_struct *fs)
1393 if (altrootmnt) 1393 if (altrootmnt)
1394 mntput(altrootmnt); 1394 mntput(altrootmnt);
1395 1395
1396out:
1397 return new_ns; 1396 return new_ns;
1398} 1397}
1399 1398
diff --git a/fs/nfsctl.c b/fs/nfsctl.c
index 0d4cf9486068..1c72c7f85ddc 100644
--- a/fs/nfsctl.c
+++ b/fs/nfsctl.c
@@ -98,10 +98,8 @@ asmlinkage sys_nfsservctl(int cmd, struct nfsctl_arg __user *arg, void __user *r
98 if (copy_from_user(&version, &arg->ca_version, sizeof(int))) 98 if (copy_from_user(&version, &arg->ca_version, sizeof(int)))
99 return -EFAULT; 99 return -EFAULT;
100 100
101 if (version != NFSCTL_VERSION) { 101 if (version != NFSCTL_VERSION)
102 printk(KERN_WARNING "nfsd: incompatible version in syscall.\n");
103 return -EINVAL; 102 return -EINVAL;
104 }
105 103
106 if (cmd < 0 || cmd >= sizeof(map)/sizeof(map[0]) || !map[cmd].name) 104 if (cmd < 0 || cmd >= sizeof(map)/sizeof(map[0]) || !map[cmd].name)
107 return -EINVAL; 105 return -EINVAL;