Merge branch 'for-2.6.30' of git://linux-nfs.org/~bfields/linux

* 'for-2.6.30' of git://linux-nfs.org/~bfields/linux:
  nfsd: silence lockdep warning
  lockd: fix list corruption on lockd restart
  nfsd4: check for negative dentry before use in nfsv4 readdir
  nfsd41: slots are freed with session
  svcrdma: clean up error paths.
  svcrdma: Fix dma map direction for rdma read targets
This commit is contained in:
Linus Torvalds 2009-05-12 17:11:56 -07:00
commit 2ea3f86848
7 changed files with 34 additions and 10 deletions

View File

@ -104,6 +104,16 @@ static void set_grace_period(void)
schedule_delayed_work(&grace_period_end, grace_period); schedule_delayed_work(&grace_period_end, grace_period);
} }
static void restart_grace(void)
{
if (nlmsvc_ops) {
cancel_delayed_work_sync(&grace_period_end);
locks_end_grace(&lockd_manager);
nlmsvc_invalidate_all();
set_grace_period();
}
}
/* /*
* This is the lockd kernel thread * This is the lockd kernel thread
*/ */
@ -149,10 +159,7 @@ lockd(void *vrqstp)
if (signalled()) { if (signalled()) {
flush_signals(current); flush_signals(current);
if (nlmsvc_ops) { restart_grace();
nlmsvc_invalidate_all();
set_grace_period();
}
continue; continue;
} }

View File

@ -229,7 +229,7 @@ nfsd4_list_rec_dir(struct dentry *dir, recdir_func *f)
goto out; goto out;
status = vfs_readdir(filp, nfsd4_build_namelist, &names); status = vfs_readdir(filp, nfsd4_build_namelist, &names);
fput(filp); fput(filp);
mutex_lock(&dir->d_inode->i_mutex); mutex_lock_nested(&dir->d_inode->i_mutex, I_MUTEX_PARENT);
while (!list_empty(&names)) { while (!list_empty(&names)) {
entry = list_entry(names.next, struct name_list, list); entry = list_entry(names.next, struct name_list, list);
@ -264,7 +264,7 @@ nfsd4_unlink_clid_dir(char *name, int namlen)
dprintk("NFSD: nfsd4_unlink_clid_dir. name %.*s\n", namlen, name); dprintk("NFSD: nfsd4_unlink_clid_dir. name %.*s\n", namlen, name);
mutex_lock(&rec_dir.dentry->d_inode->i_mutex); mutex_lock_nested(&rec_dir.dentry->d_inode->i_mutex, I_MUTEX_PARENT);
dentry = lookup_one_len(name, rec_dir.dentry, namlen); dentry = lookup_one_len(name, rec_dir.dentry, namlen);
if (IS_ERR(dentry)) { if (IS_ERR(dentry)) {
status = PTR_ERR(dentry); status = PTR_ERR(dentry);

View File

@ -580,7 +580,6 @@ free_session(struct kref *kref)
struct nfsd4_cache_entry *e = &ses->se_slots[i].sl_cache_entry; struct nfsd4_cache_entry *e = &ses->se_slots[i].sl_cache_entry;
nfsd4_release_respages(e->ce_respages, e->ce_resused); nfsd4_release_respages(e->ce_respages, e->ce_resused);
} }
kfree(ses->se_slots);
kfree(ses); kfree(ses);
} }

View File

@ -2214,6 +2214,15 @@ nfsd4_encode_dirent_fattr(struct nfsd4_readdir *cd,
dentry = lookup_one_len(name, cd->rd_fhp->fh_dentry, namlen); dentry = lookup_one_len(name, cd->rd_fhp->fh_dentry, namlen);
if (IS_ERR(dentry)) if (IS_ERR(dentry))
return nfserrno(PTR_ERR(dentry)); return nfserrno(PTR_ERR(dentry));
if (!dentry->d_inode) {
/*
* nfsd_buffered_readdir drops the i_mutex between
* readdir and calling this callback, leaving a window
* where this directory entry could have gone away.
*/
dput(dentry);
return nfserr_noent;
}
exp_get(exp); exp_get(exp);
/* /*
@ -2276,6 +2285,7 @@ nfsd4_encode_dirent(void *ccdv, const char *name, int namlen,
struct nfsd4_readdir *cd = container_of(ccd, struct nfsd4_readdir, common); struct nfsd4_readdir *cd = container_of(ccd, struct nfsd4_readdir, common);
int buflen; int buflen;
__be32 *p = cd->buffer; __be32 *p = cd->buffer;
__be32 *cookiep;
__be32 nfserr = nfserr_toosmall; __be32 nfserr = nfserr_toosmall;
/* In nfsv4, "." and ".." never make it onto the wire.. */ /* In nfsv4, "." and ".." never make it onto the wire.. */
@ -2292,7 +2302,7 @@ nfsd4_encode_dirent(void *ccdv, const char *name, int namlen,
goto fail; goto fail;
*p++ = xdr_one; /* mark entry present */ *p++ = xdr_one; /* mark entry present */
cd->offset = p; /* remember pointer */ cookiep = p;
p = xdr_encode_hyper(p, NFS_OFFSET_MAX); /* offset of next entry */ p = xdr_encode_hyper(p, NFS_OFFSET_MAX); /* offset of next entry */
p = xdr_encode_array(p, name, namlen); /* name length & name */ p = xdr_encode_array(p, name, namlen); /* name length & name */
@ -2306,6 +2316,8 @@ nfsd4_encode_dirent(void *ccdv, const char *name, int namlen,
goto fail; goto fail;
case nfserr_dropit: case nfserr_dropit:
goto fail; goto fail;
case nfserr_noent:
goto skip_entry;
default: default:
/* /*
* If the client requested the RDATTR_ERROR attribute, * If the client requested the RDATTR_ERROR attribute,
@ -2324,6 +2336,8 @@ nfsd4_encode_dirent(void *ccdv, const char *name, int namlen,
} }
cd->buflen -= (p - cd->buffer); cd->buflen -= (p - cd->buffer);
cd->buffer = p; cd->buffer = p;
cd->offset = cookiep;
skip_entry:
cd->common.err = nfs_ok; cd->common.err = nfs_ok;
return 0; return 0;
fail: fail:

View File

@ -265,7 +265,7 @@ static int fast_reg_read_chunks(struct svcxprt_rdma *xprt,
frmr->page_list->page_list[page_no] = frmr->page_list->page_list[page_no] =
ib_dma_map_single(xprt->sc_cm_id->device, ib_dma_map_single(xprt->sc_cm_id->device,
page_address(rqstp->rq_arg.pages[page_no]), page_address(rqstp->rq_arg.pages[page_no]),
PAGE_SIZE, DMA_TO_DEVICE); PAGE_SIZE, DMA_FROM_DEVICE);
if (ib_dma_mapping_error(xprt->sc_cm_id->device, if (ib_dma_mapping_error(xprt->sc_cm_id->device,
frmr->page_list->page_list[page_no])) frmr->page_list->page_list[page_no]))
goto fatal_err; goto fatal_err;

View File

@ -183,6 +183,7 @@ static int fast_reg_xdr(struct svcxprt_rdma *xprt,
fatal_err: fatal_err:
printk("svcrdma: Error fast registering memory for xprt %p\n", xprt); printk("svcrdma: Error fast registering memory for xprt %p\n", xprt);
vec->frmr = NULL;
svc_rdma_put_frmr(xprt, frmr); svc_rdma_put_frmr(xprt, frmr);
return -EIO; return -EIO;
} }
@ -516,6 +517,7 @@ static int send_reply(struct svcxprt_rdma *rdma,
"svcrdma: could not post a receive buffer, err=%d." "svcrdma: could not post a receive buffer, err=%d."
"Closing transport %p.\n", ret, rdma); "Closing transport %p.\n", ret, rdma);
set_bit(XPT_CLOSE, &rdma->sc_xprt.xpt_flags); set_bit(XPT_CLOSE, &rdma->sc_xprt.xpt_flags);
svc_rdma_put_frmr(rdma, vec->frmr);
svc_rdma_put_context(ctxt, 0); svc_rdma_put_context(ctxt, 0);
return -ENOTCONN; return -ENOTCONN;
} }
@ -606,6 +608,7 @@ static int send_reply(struct svcxprt_rdma *rdma,
return 0; return 0;
err: err:
svc_rdma_unmap_dma(ctxt);
svc_rdma_put_frmr(rdma, vec->frmr); svc_rdma_put_frmr(rdma, vec->frmr);
svc_rdma_put_context(ctxt, 1); svc_rdma_put_context(ctxt, 1);
return -EIO; return -EIO;

View File

@ -520,8 +520,9 @@ int svc_rdma_post_recv(struct svcxprt_rdma *xprt)
svc_xprt_get(&xprt->sc_xprt); svc_xprt_get(&xprt->sc_xprt);
ret = ib_post_recv(xprt->sc_qp, &recv_wr, &bad_recv_wr); ret = ib_post_recv(xprt->sc_qp, &recv_wr, &bad_recv_wr);
if (ret) { if (ret) {
svc_xprt_put(&xprt->sc_xprt); svc_rdma_unmap_dma(ctxt);
svc_rdma_put_context(ctxt, 1); svc_rdma_put_context(ctxt, 1);
svc_xprt_put(&xprt->sc_xprt);
} }
return ret; return ret;