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
741741 if (data->rpc_status == 0) {
742742 memcpy(data->o_res.stateid.data, data->c_res.stateid.data,
743743 sizeof(data->o_res.stateid.data));
744+ nfs_confirm_seqid(&data->owner->so_seqid, 0);
744745 renew_lease(data->o_res.server, data->timestamp);
745746 data->rpc_done = 1;
746747 }
747− nfs_confirm_seqid(&data->owner->so_seqid, data->rpc_status);
748748 nfs_increment_open_seqid(data->rpc_status, data->c_arg.seqid);
749749 }
750750
@@ -759,7 +759,6 @@ static void nfs4_open_confirm_release(void *calldata) · 8 unmodified lines
759759 /* In case of error, no cleanup! */
760760 if (!data->rpc_done)
761761 goto out_free;
762− nfs_confirm_seqid(&data->owner->so_seqid, 0);
763762 state = nfs4_opendata_to_nfs4_state(data);
764763 if (!IS_ERR(state))
765764 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
886885 /* In case we need an open_confirm, no cleanup! */
887886 if (data->o_res.rflags & NFS4_OPEN_RESULT_CONFIRM)
888887 goto out_free;
889− nfs_confirm_seqid(&data->owner->so_seqid, 0);
890888 state = nfs4_opendata_to_nfs4_state(data);
891889 if (!IS_ERR(state))
892890 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
33333331
33343332 p->arg.fh = NFS_FH(inode);
33353333 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+ }
33363340 p->arg.lock_seqid = nfs_alloc_seqid(&lsp->ls_seqid);
33373341 if (p->arg.lock_seqid == NULL)
33383342 goto out_free;
@@ -3345,6 +3349,8 @@ static struct nfs4_lockdata *nfs4_alloc_lockdata(struct file_lock *fl, · 6 unmodified lines
33453349 memcpy(&p->fl, fl, sizeof(p->fl));
33463350 return p;
33473351 out_free:
3352+ if (p->arg.open_seqid != NULL)
3353+ nfs_free_seqid(p->arg.open_seqid);
33483354 kfree(p);
33493355 return NULL;
33503356 }
@@ -3361,23 +3367,23 @@ static void nfs4_lock_prepare(struct rpc_task *task, void *calldata) · 10 unmodified lines
33613367 .rpc_cred = sp->so_cred,
33623368 };
33633369
3364− if (nfs_wait_on_sequence(data->arg.lock_seqid, task) != 0)
3365− return;
33663370 dprintk("%s: begin!\n", __FUNCTION__);
33673371 /* Do we need to do an open_to_lock_owner? */
33683372 if (!(data->arg.lock_seqid->sequence->flags & NFS_SEQID_CONFIRMED)) {
3369− data->arg.open_seqid = nfs_alloc_seqid(&sp->so_seqid);
3370− if (data->arg.open_seqid == NULL) {
3371− data->rpc_status = -ENOMEM;
3372− task->tk_action = NULL;
3373− goto out;
3374− }
3373+ if (nfs_wait_on_sequence(data->arg.open_seqid, task) != 0)
3374+ return;
33753375 data->arg.open_stateid = &state->stateid;
33763376 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;
33773380 }
3381+ if (nfs_wait_on_sequence(data->arg.lock_seqid, task) != 0)
3382+ return;
3383+ data->arg.new_lock_owner = 0;
3384+do_rpc:
33783385 data->timestamp = jiffies;
33793386 rpc_call_setup(task, &msg, 0);
3380−out:
33813387 dprintk("%s: done!, ret = %d\n", __FUNCTION__, data->rpc_status);
33823388 }
33833389
@@ -3413,8 +3419,6 @@ static void nfs4_lock_release(void *calldata) · 29 unmodified lines
34133419 struct nfs4_lockdata *data = calldata;
34143420
34153421 dprintk("%s: begin!\n", __FUNCTION__);
3416− if (data->arg.open_seqid != NULL)
3417− nfs_free_seqid(data->arg.open_seqid);
34183422 if (data->cancelled != 0) {
34193423 struct rpc_task *task;
34203424 task = nfs4_do_unlck(&data->fl, data->ctx, data->lsp,
@@ -3424,6 +3428,8 @@ static void nfs4_lock_release(void *calldata) · 3 unmodified lines
34243428 dprintk("%s: cancelling lock!\n", __FUNCTION__);
34253429 } else
34263430 nfs_free_seqid(data->arg.lock_seqid);
3431+ if (data->arg.open_seqid != NULL)
3432+ nfs_free_seqid(data->arg.open_seqid);
34273433 nfs4_put_lock_state(data->lsp);
34283434 put_nfs_open_context(data->ctx);
34293435 kfree(data);
fs/nfs/nfs4renewd.c+0−2
@@ -133,9 +133,7 @@ nfs4_renewd_prepare_shutdown(struct nfs_server *server) · 132 unmodified lines
133133 void
134134 nfs4_kill_renewd(struct nfs_client *clp)
135135 {
136− down_read(&clp->cl_sem);
137136 cancel_delayed_work_sync(&clp->cl_renewd);
138− up_read(&clp->cl_sem);
139137 }
140138
141139 /*
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
14751475 error = PTR_ERR(mntroot);
14761476 goto error_splat_super;
14771477 }
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) {
14791479 dput(mntroot);
14801480 error = -ESTALE;
14811481 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
18261826 error = PTR_ERR(mntroot);
18271827 goto error_splat_super;
18281828 }
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+ }
18291834
18301835 s->s_flags |= MS_ACTIVE;
18311836 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
19001905 error = PTR_ERR(mntroot);
19011906 goto error_splat_super;
19021907 }
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+ }
19031913
19041914 s->s_flags |= MS_ACTIVE;
19051915 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
625625 err = -EINVAL;
626626 gss_auth->mech = gss_mech_get_by_pseudoflavor(flavor);
627627 if (!gss_auth->mech) {
628− printk(KERN_WARNING "%s: Pseudoflavor %d not found!",
628+ printk(KERN_WARNING "%s: Pseudoflavor %d not found!\n",
629629 __FUNCTION__, flavor);
630630 goto err_free;
631631 }