History

Merge git://git.linux-nfs.org/pub/linux/nfs-2.6

* git://git.linux-nfs.org/pub/linux/nfs-2.6: NFSv4: Fix open_to_lock_owner sequenceid allocation... NFSv4: nfs4_open_confirm must not set the open_owner as confirmed on error NFS: add newline to kernel warning message in auth_gss code NFSv4: Fix circular locking dependency in nfs4_kill_renewd NFS: Fix a possible Oops in fs/nfs/super.c

Linus Torvalds committed 18 years ago

Commit 2c5d63d2 parents 3a62b5f e6e21974 files · +32 −18Browse files

Unified · Split

4 files
  1. fs/nfs/nfs4proc.c +20 −14
  2. fs/nfs/nfs4renewd.c +0 −2
  3. fs/nfs/super.c +11 −1
  4. net/sunrpc/auth_gss/auth_gss.c +1 −1
fs/nfs/nfs4proc.c+20−14
@@ -741,10 +741,10 @@ static void nfs4_open_confirm_done(struct rpc_task *task, void *calldata) · 740 unmodified lines
741 if (data->rpc_status == 0) {741 if (data->rpc_status == 0) {
742 memcpy(data->o_res.stateid.data, data->c_res.stateid.data,742 memcpy(data->o_res.stateid.data, data->c_res.stateid.data,
743 sizeof(data->o_res.stateid.data));743 sizeof(data->o_res.stateid.data));
744 nfs_confirm_seqid(&data->owner->so_seqid, 0);
744 renew_lease(data->o_res.server, data->timestamp);745 renew_lease(data->o_res.server, data->timestamp);
745 data->rpc_done = 1;746 data->rpc_done = 1;
746 }747 }
747 nfs_confirm_seqid(&data->owner->so_seqid, data->rpc_status);
748 nfs_increment_open_seqid(data->rpc_status, data->c_arg.seqid);748 nfs_increment_open_seqid(data->rpc_status, data->c_arg.seqid);
749}749}
750 750
@@ -759,7 +759,6 @@ static void nfs4_open_confirm_release(void *calldata) · 8 unmodified lines
759 /* In case of error, no cleanup! */759 /* In case of error, no cleanup! */
760 if (!data->rpc_done)760 if (!data->rpc_done)
761 goto out_free;761 goto out_free;
762 nfs_confirm_seqid(&data->owner->so_seqid, 0);
763 state = nfs4_opendata_to_nfs4_state(data);762 state = nfs4_opendata_to_nfs4_state(data);
764 if (!IS_ERR(state))763 if (!IS_ERR(state))
765 nfs4_close_state(&data->path, state, data->o_arg.open_flags);764 nfs4_close_state(&data->path, state, data->o_arg.open_flags);
@@ -886,7 +885,6 @@ static void nfs4_open_release(void *calldata) · 120 unmodified lines
886 /* In case we need an open_confirm, no cleanup! */885 /* In case we need an open_confirm, no cleanup! */
887 if (data->o_res.rflags & NFS4_OPEN_RESULT_CONFIRM)886 if (data->o_res.rflags & NFS4_OPEN_RESULT_CONFIRM)
888 goto out_free;887 goto out_free;
889 nfs_confirm_seqid(&data->owner->so_seqid, 0);
890 state = nfs4_opendata_to_nfs4_state(data);888 state = nfs4_opendata_to_nfs4_state(data);
891 if (!IS_ERR(state))889 if (!IS_ERR(state))
892 nfs4_close_state(&data->path, state, data->o_arg.open_flags);890 nfs4_close_state(&data->path, state, data->o_arg.open_flags);
@@ -3333,6 +3331,12 @@ static struct nfs4_lockdata *nfs4_alloc_lockdata(struct file_lock *fl, · 2440 unmodified lines
3333 3331
3334 p->arg.fh = NFS_FH(inode);3332 p->arg.fh = NFS_FH(inode);
3335 p->arg.fl = &p->fl;3333 p->arg.fl = &p->fl;
3334 if (!(lsp->ls_seqid.flags & NFS_SEQID_CONFIRMED)) {
3335 p->arg.open_seqid = nfs_alloc_seqid(&lsp->ls_state->owner->so_seqid);
3336 if (p->arg.open_seqid == NULL)
3337 goto out_free;
3338
3339 }
3336 p->arg.lock_seqid = nfs_alloc_seqid(&lsp->ls_seqid);3340 p->arg.lock_seqid = nfs_alloc_seqid(&lsp->ls_seqid);
3337 if (p->arg.lock_seqid == NULL)3341 if (p->arg.lock_seqid == NULL)
3338 goto out_free;3342 goto out_free;
@@ -3345,6 +3349,8 @@ static struct nfs4_lockdata *nfs4_alloc_lockdata(struct file_lock *fl, · 6 unmodified lines
3345 memcpy(&p->fl, fl, sizeof(p->fl));3349 memcpy(&p->fl, fl, sizeof(p->fl));
3346 return p;3350 return p;
3347out_free:3351out_free:
3352 if (p->arg.open_seqid != NULL)
3353 nfs_free_seqid(p->arg.open_seqid);
3348 kfree(p);3354 kfree(p);
3349 return NULL;3355 return NULL;
3350}3356}
@@ -3361,23 +3367,23 @@ static void nfs4_lock_prepare(struct rpc_task *task, void *calldata) · 10 unmodified lines
3361 .rpc_cred = sp->so_cred,3367 .rpc_cred = sp->so_cred,
3362 };3368 };
3363 3369
3364 if (nfs_wait_on_sequence(data->arg.lock_seqid, task) != 0)
3365 return;
3366 dprintk("%s: begin!\n", __FUNCTION__);3370 dprintk("%s: begin!\n", __FUNCTION__);
3367 /* Do we need to do an open_to_lock_owner? */3371 /* Do we need to do an open_to_lock_owner? */
3368 if (!(data->arg.lock_seqid->sequence->flags & NFS_SEQID_CONFIRMED)) {3372 if (!(data->arg.lock_seqid->sequence->flags & NFS_SEQID_CONFIRMED)) {
3369 data->arg.open_seqid = nfs_alloc_seqid(&sp->so_seqid);3373 if (nfs_wait_on_sequence(data->arg.open_seqid, task) != 0)
3370 if (data->arg.open_seqid == NULL) {3374 return;
3371 data->rpc_status = -ENOMEM;
3372 task->tk_action = NULL;
3373 goto out;
3374 }
3375 data->arg.open_stateid = &state->stateid;3375 data->arg.open_stateid = &state->stateid;
3376 data->arg.new_lock_owner = 1;3376 data->arg.new_lock_owner = 1;
3377 /* Retest in case we raced... */
3378 if (!(data->arg.lock_seqid->sequence->flags & NFS_SEQID_CONFIRMED))
3379 goto do_rpc;
3377 }3380 }
3381 if (nfs_wait_on_sequence(data->arg.lock_seqid, task) != 0)
3382 return;
3383 data->arg.new_lock_owner = 0;
3384do_rpc:
3378 data->timestamp = jiffies;3385 data->timestamp = jiffies;
3379 rpc_call_setup(task, &msg, 0);3386 rpc_call_setup(task, &msg, 0);
3380out:
3381 dprintk("%s: done!, ret = %d\n", __FUNCTION__, data->rpc_status);3387 dprintk("%s: done!, ret = %d\n", __FUNCTION__, data->rpc_status);
3382}3388}
3383 3389
@@ -3413,8 +3419,6 @@ static void nfs4_lock_release(void *calldata) · 29 unmodified lines
3413 struct nfs4_lockdata *data = calldata;3419 struct nfs4_lockdata *data = calldata;
3414 3420
3415 dprintk("%s: begin!\n", __FUNCTION__);3421 dprintk("%s: begin!\n", __FUNCTION__);
3416 if (data->arg.open_seqid != NULL)
3417 nfs_free_seqid(data->arg.open_seqid);
3418 if (data->cancelled != 0) {3422 if (data->cancelled != 0) {
3419 struct rpc_task *task;3423 struct rpc_task *task;
3420 task = nfs4_do_unlck(&data->fl, data->ctx, data->lsp,3424 task = nfs4_do_unlck(&data->fl, data->ctx, data->lsp,
@@ -3424,6 +3428,8 @@ static void nfs4_lock_release(void *calldata) · 3 unmodified lines
3424 dprintk("%s: cancelling lock!\n", __FUNCTION__);3428 dprintk("%s: cancelling lock!\n", __FUNCTION__);
3425 } else3429 } else
3426 nfs_free_seqid(data->arg.lock_seqid);3430 nfs_free_seqid(data->arg.lock_seqid);
3431 if (data->arg.open_seqid != NULL)
3432 nfs_free_seqid(data->arg.open_seqid);
3427 nfs4_put_lock_state(data->lsp);3433 nfs4_put_lock_state(data->lsp);
3428 put_nfs_open_context(data->ctx);3434 put_nfs_open_context(data->ctx);
3429 kfree(data);3435 kfree(data);
fs/nfs/nfs4renewd.c+0−2
@@ -133,9 +133,7 @@ nfs4_renewd_prepare_shutdown(struct nfs_server *server) · 132 unmodified lines
133void133void
134nfs4_kill_renewd(struct nfs_client *clp)134nfs4_kill_renewd(struct nfs_client *clp)
135{135{
136 down_read(&clp->cl_sem);
137 cancel_delayed_work_sync(&clp->cl_renewd);136 cancel_delayed_work_sync(&clp->cl_renewd);
138 up_read(&clp->cl_sem);
139}137}
140 138
141/*139/*
fs/nfs/super.c+11−1
@@ -1475,7 +1475,7 @@ static int nfs_xdev_get_sb(struct file_system_type *fs_type, int flags, · 1474 unmodified lines
1475 error = PTR_ERR(mntroot);1475 error = PTR_ERR(mntroot);
1476 goto error_splat_super;1476 goto error_splat_super;
1477 }1477 }
1478 if (mntroot->d_inode->i_op != server->nfs_client->rpc_ops->dir_inode_ops) {1478 if (mntroot->d_inode->i_op != NFS_SB(s)->nfs_client->rpc_ops->dir_inode_ops) {
1479 dput(mntroot);1479 dput(mntroot);
1480 error = -ESTALE;1480 error = -ESTALE;
1481 goto error_splat_super;1481 goto error_splat_super;
@@ -1826,6 +1826,11 @@ static int nfs4_xdev_get_sb(struct file_system_type *fs_type, int flags, · 344 unmodified lines
1826 error = PTR_ERR(mntroot);1826 error = PTR_ERR(mntroot);
1827 goto error_splat_super;1827 goto error_splat_super;
1828 }1828 }
1829 if (mntroot->d_inode->i_op != NFS_SB(s)->nfs_client->rpc_ops->dir_inode_ops) {
1830 dput(mntroot);
1831 error = -ESTALE;
1832 goto error_splat_super;
1833 }
1829 1834
1830 s->s_flags |= MS_ACTIVE;1835 s->s_flags |= MS_ACTIVE;
1831 mnt->mnt_sb = s;1836 mnt->mnt_sb = s;
@@ -1900,6 +1905,11 @@ static int nfs4_referral_get_sb(struct file_system_type *fs_type, int flags, · 68 unmodified lines
1900 error = PTR_ERR(mntroot);1905 error = PTR_ERR(mntroot);
1901 goto error_splat_super;1906 goto error_splat_super;
1902 }1907 }
1908 if (mntroot->d_inode->i_op != NFS_SB(s)->nfs_client->rpc_ops->dir_inode_ops) {
1909 dput(mntroot);
1910 error = -ESTALE;
1911 goto error_splat_super;
1912 }
1903 1913
1904 s->s_flags |= MS_ACTIVE;1914 s->s_flags |= MS_ACTIVE;
1905 mnt->mnt_sb = s;1915 mnt->mnt_sb = s;
net/sunrpc/auth_gss/auth_gss.c+1−1
@@ -625,7 +625,7 @@ gss_create(struct rpc_clnt *clnt, rpc_authflavor_t flavor) · 624 unmodified lines
625 err = -EINVAL;625 err = -EINVAL;
626 gss_auth->mech = gss_mech_get_by_pseudoflavor(flavor);626 gss_auth->mech = gss_mech_get_by_pseudoflavor(flavor);
627 if (!gss_auth->mech) {627 if (!gss_auth->mech) {
628 printk(KERN_WARNING "%s: Pseudoflavor %d not found!",628 printk(KERN_WARNING "%s: Pseudoflavor %d not found!\n",
629 __FUNCTION__, flavor);629 __FUNCTION__, flavor);
630 goto err_free;630 goto err_free;
631 }631 }