diff options
Diffstat (limited to 'fs')
| -rw-r--r-- | fs/block_dev.c | 21 | ||||
| -rw-r--r-- | fs/exportfs/expfs.c | 4 | ||||
| -rw-r--r-- | fs/fcntl.c | 7 | ||||
| -rw-r--r-- | fs/ioctl.c | 12 | ||||
| -rw-r--r-- | fs/lockd/host.c | 3 | ||||
| -rw-r--r-- | fs/lockd/svc.c | 1 | ||||
| -rw-r--r-- | fs/nfsd/nfs4recover.c | 2 | ||||
| -rw-r--r-- | fs/nfsd/nfs4state.c | 1 | ||||
| -rw-r--r-- | fs/xfs/xfs_rename.c | 2 |
9 files changed, 41 insertions, 12 deletions
diff --git a/fs/block_dev.c b/fs/block_dev.c index db831efbdbbd..99e0ae1a4c78 100644 --- a/fs/block_dev.c +++ b/fs/block_dev.c | |||
| @@ -1135,12 +1135,15 @@ static int blkdev_open(struct inode * inode, struct file * filp) | |||
| 1135 | if (res) | 1135 | if (res) |
| 1136 | return res; | 1136 | return res; |
| 1137 | 1137 | ||
| 1138 | if (!(filp->f_mode & FMODE_EXCL)) | 1138 | if (filp->f_mode & FMODE_EXCL) { |
| 1139 | return 0; | 1139 | res = bd_claim(bdev, filp); |
| 1140 | if (res) | ||
| 1141 | goto out_blkdev_put; | ||
| 1142 | } | ||
| 1140 | 1143 | ||
| 1141 | if (!(res = bd_claim(bdev, filp))) | 1144 | return 0; |
| 1142 | return 0; | ||
| 1143 | 1145 | ||
| 1146 | out_blkdev_put: | ||
| 1144 | blkdev_put(bdev, filp->f_mode); | 1147 | blkdev_put(bdev, filp->f_mode); |
| 1145 | return res; | 1148 | return res; |
| 1146 | } | 1149 | } |
| @@ -1203,8 +1206,16 @@ static long block_ioctl(struct file *file, unsigned cmd, unsigned long arg) | |||
| 1203 | { | 1206 | { |
| 1204 | struct block_device *bdev = I_BDEV(file->f_mapping->host); | 1207 | struct block_device *bdev = I_BDEV(file->f_mapping->host); |
| 1205 | fmode_t mode = file->f_mode; | 1208 | fmode_t mode = file->f_mode; |
| 1209 | |||
| 1210 | /* | ||
| 1211 | * O_NDELAY can be altered using fcntl(.., F_SETFL, ..), so we have | ||
| 1212 | * to updated it before every ioctl. | ||
| 1213 | */ | ||
| 1206 | if (file->f_flags & O_NDELAY) | 1214 | if (file->f_flags & O_NDELAY) |
| 1207 | mode |= FMODE_NDELAY_NOW; | 1215 | mode |= FMODE_NDELAY; |
| 1216 | else | ||
| 1217 | mode &= ~FMODE_NDELAY; | ||
| 1218 | |||
| 1208 | return blkdev_ioctl(bdev, mode, cmd, arg); | 1219 | return blkdev_ioctl(bdev, mode, cmd, arg); |
| 1209 | } | 1220 | } |
| 1210 | 1221 | ||
diff --git a/fs/exportfs/expfs.c b/fs/exportfs/expfs.c index 80246bad1b7f..890e01828817 100644 --- a/fs/exportfs/expfs.c +++ b/fs/exportfs/expfs.c | |||
| @@ -367,6 +367,8 @@ struct dentry *exportfs_decode_fh(struct vfsmount *mnt, struct fid *fid, | |||
| 367 | * Try to get any dentry for the given file handle from the filesystem. | 367 | * Try to get any dentry for the given file handle from the filesystem. |
| 368 | */ | 368 | */ |
| 369 | result = nop->fh_to_dentry(mnt->mnt_sb, fid, fh_len, fileid_type); | 369 | result = nop->fh_to_dentry(mnt->mnt_sb, fid, fh_len, fileid_type); |
| 370 | if (!result) | ||
| 371 | result = ERR_PTR(-ESTALE); | ||
| 370 | if (IS_ERR(result)) | 372 | if (IS_ERR(result)) |
| 371 | return result; | 373 | return result; |
| 372 | 374 | ||
| @@ -420,6 +422,8 @@ struct dentry *exportfs_decode_fh(struct vfsmount *mnt, struct fid *fid, | |||
| 420 | 422 | ||
| 421 | target_dir = nop->fh_to_parent(mnt->mnt_sb, fid, | 423 | target_dir = nop->fh_to_parent(mnt->mnt_sb, fid, |
| 422 | fh_len, fileid_type); | 424 | fh_len, fileid_type); |
| 425 | if (!target_dir) | ||
| 426 | goto err_result; | ||
| 423 | err = PTR_ERR(target_dir); | 427 | err = PTR_ERR(target_dir); |
| 424 | if (IS_ERR(target_dir)) | 428 | if (IS_ERR(target_dir)) |
| 425 | goto err_result; | 429 | goto err_result; |
diff --git a/fs/fcntl.c b/fs/fcntl.c index ac4f7db9f134..549daf8005fb 100644 --- a/fs/fcntl.c +++ b/fs/fcntl.c | |||
| @@ -19,6 +19,7 @@ | |||
| 19 | #include <linux/signal.h> | 19 | #include <linux/signal.h> |
| 20 | #include <linux/rcupdate.h> | 20 | #include <linux/rcupdate.h> |
| 21 | #include <linux/pid_namespace.h> | 21 | #include <linux/pid_namespace.h> |
| 22 | #include <linux/smp_lock.h> | ||
| 22 | 23 | ||
| 23 | #include <asm/poll.h> | 24 | #include <asm/poll.h> |
| 24 | #include <asm/siginfo.h> | 25 | #include <asm/siginfo.h> |
| @@ -175,6 +176,11 @@ static int setfl(int fd, struct file * filp, unsigned long arg) | |||
| 175 | if (error) | 176 | if (error) |
| 176 | return error; | 177 | return error; |
| 177 | 178 | ||
| 179 | /* | ||
| 180 | * We still need a lock here for now to keep multiple FASYNC calls | ||
| 181 | * from racing with each other. | ||
| 182 | */ | ||
| 183 | lock_kernel(); | ||
| 178 | if ((arg ^ filp->f_flags) & FASYNC) { | 184 | if ((arg ^ filp->f_flags) & FASYNC) { |
| 179 | if (filp->f_op && filp->f_op->fasync) { | 185 | if (filp->f_op && filp->f_op->fasync) { |
| 180 | error = filp->f_op->fasync(fd, filp, (arg & FASYNC) != 0); | 186 | error = filp->f_op->fasync(fd, filp, (arg & FASYNC) != 0); |
| @@ -185,6 +191,7 @@ static int setfl(int fd, struct file * filp, unsigned long arg) | |||
| 185 | 191 | ||
| 186 | filp->f_flags = (arg & SETFL_MASK) | (filp->f_flags & ~SETFL_MASK); | 192 | filp->f_flags = (arg & SETFL_MASK) | (filp->f_flags & ~SETFL_MASK); |
| 187 | out: | 193 | out: |
| 194 | unlock_kernel(); | ||
| 188 | return error; | 195 | return error; |
| 189 | } | 196 | } |
| 190 | 197 | ||
diff --git a/fs/ioctl.c b/fs/ioctl.c index d152856c371b..43e8b2c0664b 100644 --- a/fs/ioctl.c +++ b/fs/ioctl.c | |||
| @@ -400,11 +400,9 @@ static int ioctl_fioasync(unsigned int fd, struct file *filp, | |||
| 400 | 400 | ||
| 401 | /* Did FASYNC state change ? */ | 401 | /* Did FASYNC state change ? */ |
| 402 | if ((flag ^ filp->f_flags) & FASYNC) { | 402 | if ((flag ^ filp->f_flags) & FASYNC) { |
| 403 | if (filp->f_op && filp->f_op->fasync) { | 403 | if (filp->f_op && filp->f_op->fasync) |
| 404 | lock_kernel(); | ||
| 405 | error = filp->f_op->fasync(fd, filp, on); | 404 | error = filp->f_op->fasync(fd, filp, on); |
| 406 | unlock_kernel(); | 405 | else |
| 407 | } else | ||
| 408 | error = -ENOTTY; | 406 | error = -ENOTTY; |
| 409 | } | 407 | } |
| 410 | if (error) | 408 | if (error) |
| @@ -440,11 +438,17 @@ int do_vfs_ioctl(struct file *filp, unsigned int fd, unsigned int cmd, | |||
| 440 | break; | 438 | break; |
| 441 | 439 | ||
| 442 | case FIONBIO: | 440 | case FIONBIO: |
| 441 | /* BKL needed to avoid races tweaking f_flags */ | ||
| 442 | lock_kernel(); | ||
| 443 | error = ioctl_fionbio(filp, argp); | 443 | error = ioctl_fionbio(filp, argp); |
| 444 | unlock_kernel(); | ||
| 444 | break; | 445 | break; |
| 445 | 446 | ||
| 446 | case FIOASYNC: | 447 | case FIOASYNC: |
| 448 | /* BKL needed to avoid races tweaking f_flags */ | ||
| 449 | lock_kernel(); | ||
| 447 | error = ioctl_fioasync(fd, filp, argp); | 450 | error = ioctl_fioasync(fd, filp, argp); |
| 451 | unlock_kernel(); | ||
| 448 | break; | 452 | break; |
| 449 | 453 | ||
| 450 | case FIOQSIZE: | 454 | case FIOQSIZE: |
diff --git a/fs/lockd/host.c b/fs/lockd/host.c index 9fd8889097b7..70fc63a1727b 100644 --- a/fs/lockd/host.c +++ b/fs/lockd/host.c | |||
| @@ -167,7 +167,8 @@ static struct nlm_host *nlm_lookup_host(struct nlm_lookup_host_info *ni) | |||
| 167 | continue; | 167 | continue; |
| 168 | if (host->h_server != ni->server) | 168 | if (host->h_server != ni->server) |
| 169 | continue; | 169 | continue; |
| 170 | if (!nlm_cmp_addr(nlm_srcaddr(host), ni->src_sap)) | 170 | if (ni->server && |
| 171 | !nlm_cmp_addr(nlm_srcaddr(host), ni->src_sap)) | ||
| 171 | continue; | 172 | continue; |
| 172 | 173 | ||
| 173 | /* Move to head of hash chain. */ | 174 | /* Move to head of hash chain. */ |
diff --git a/fs/lockd/svc.c b/fs/lockd/svc.c index c631a83931ce..56b076736b56 100644 --- a/fs/lockd/svc.c +++ b/fs/lockd/svc.c | |||
| @@ -181,6 +181,7 @@ lockd(void *vrqstp) | |||
| 181 | } | 181 | } |
| 182 | flush_signals(current); | 182 | flush_signals(current); |
| 183 | cancel_delayed_work_sync(&grace_period_end); | 183 | cancel_delayed_work_sync(&grace_period_end); |
| 184 | locks_end_grace(&lockd_manager); | ||
| 184 | if (nlmsvc_ops) | 185 | if (nlmsvc_ops) |
| 185 | nlmsvc_invalidate_all(); | 186 | nlmsvc_invalidate_all(); |
| 186 | nlm_shutdown_hosts(); | 187 | nlm_shutdown_hosts(); |
diff --git a/fs/nfsd/nfs4recover.c b/fs/nfsd/nfs4recover.c index bb93946ace22..b79ec930d9f1 100644 --- a/fs/nfsd/nfs4recover.c +++ b/fs/nfsd/nfs4recover.c | |||
| @@ -225,12 +225,12 @@ nfsd4_list_rec_dir(struct dentry *dir, recdir_func *f) | |||
| 225 | return 0; | 225 | return 0; |
| 226 | 226 | ||
| 227 | nfs4_save_user(&uid, &gid); | 227 | nfs4_save_user(&uid, &gid); |
| 228 | INIT_LIST_HEAD(dentries); | ||
| 228 | 229 | ||
| 229 | filp = dentry_open(dget(dir), mntget(rec_dir.mnt), O_RDONLY); | 230 | filp = dentry_open(dget(dir), mntget(rec_dir.mnt), O_RDONLY); |
| 230 | status = PTR_ERR(filp); | 231 | status = PTR_ERR(filp); |
| 231 | if (IS_ERR(filp)) | 232 | if (IS_ERR(filp)) |
| 232 | goto out; | 233 | goto out; |
| 233 | INIT_LIST_HEAD(dentries); | ||
| 234 | status = vfs_readdir(filp, nfsd4_build_dentrylist, &dla); | 234 | status = vfs_readdir(filp, nfsd4_build_dentrylist, &dla); |
| 235 | fput(filp); | 235 | fput(filp); |
| 236 | while (!list_empty(dentries)) { | 236 | while (!list_empty(dentries)) { |
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c index b0bebc552a11..1a052ac2bde9 100644 --- a/fs/nfsd/nfs4state.c +++ b/fs/nfsd/nfs4state.c | |||
| @@ -3261,6 +3261,7 @@ nfs4_state_shutdown(void) | |||
| 3261 | { | 3261 | { |
| 3262 | cancel_rearming_delayed_workqueue(laundry_wq, &laundromat_work); | 3262 | cancel_rearming_delayed_workqueue(laundry_wq, &laundromat_work); |
| 3263 | destroy_workqueue(laundry_wq); | 3263 | destroy_workqueue(laundry_wq); |
| 3264 | locks_end_grace(&nfsd4_manager); | ||
| 3264 | nfs4_lock_state(); | 3265 | nfs4_lock_state(); |
| 3265 | nfs4_release_reclaim(); | 3266 | nfs4_release_reclaim(); |
| 3266 | __nfs4_state_shutdown(); | 3267 | __nfs4_state_shutdown(); |
diff --git a/fs/xfs/xfs_rename.c b/fs/xfs/xfs_rename.c index d700dacdb10e..c903130be7fd 100644 --- a/fs/xfs/xfs_rename.c +++ b/fs/xfs/xfs_rename.c | |||
| @@ -212,7 +212,7 @@ xfs_rename( | |||
| 212 | if (unlikely((target_dp->i_d.di_flags & XFS_DIFLAG_PROJINHERIT) && | 212 | if (unlikely((target_dp->i_d.di_flags & XFS_DIFLAG_PROJINHERIT) && |
| 213 | (target_dp->i_d.di_projid != src_ip->i_d.di_projid))) { | 213 | (target_dp->i_d.di_projid != src_ip->i_d.di_projid))) { |
| 214 | error = XFS_ERROR(EXDEV); | 214 | error = XFS_ERROR(EXDEV); |
| 215 | xfs_rename_unlock4(inodes, XFS_ILOCK_SHARED); | 215 | xfs_rename_unlock4(inodes, XFS_ILOCK_EXCL); |
| 216 | xfs_trans_cancel(tp, cancel_flags); | 216 | xfs_trans_cancel(tp, cancel_flags); |
| 217 | goto std_return; | 217 | goto std_return; |
| 218 | } | 218 | } |
