X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=blobdiff_plain;f=lustre%2Fllite%2Fdcache.c;h=c42e89daf752fdeb7236c90a12a514ec86286017;hp=1ad965978e8b1baeb9d254d5aaac92f7f7a3127b;hb=9573911bfb4a2c3d7e2047c9d5f5440d9c7e7db5;hpb=2b294992edce5af7b79d4300ed3aa1ea6a8db850 diff --git a/lustre/llite/dcache.c b/lustre/llite/dcache.c index 1ad9659..c42e89d 100644 --- a/lustre/llite/dcache.c +++ b/lustre/llite/dcache.c @@ -27,7 +27,7 @@ * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. * - * Copyright (c) 2011, 2014, Intel Corporation. + * Copyright (c) 2011, 2015, Intel Corporation. */ /* * This file is part of Lustre, http://www.lustre.org/ @@ -125,39 +125,6 @@ static int ll_dcompare(struct dentry *parent, struct qstr *d_name, RETURN(0); } -static inline int return_if_equal(struct ldlm_lock *lock, void *data) -{ - return (ldlm_is_canceling(lock) && ldlm_is_discard_data(lock)) ? - LDLM_ITER_CONTINUE : LDLM_ITER_STOP; -} - -/* find any ldlm lock of the inode in mdc and lov - * return 0 not find - * 1 find one - * < 0 error */ -static int find_cbdata(struct inode *inode) -{ - struct ll_sb_info *sbi = ll_i2sbi(inode); - struct lov_stripe_md *lsm; - int rc = 0; - ENTRY; - - LASSERT(inode); - rc = md_find_cbdata(sbi->ll_md_exp, ll_inode2fid(inode), - return_if_equal, NULL); - if (rc != 0) - RETURN(rc); - - lsm = ccc_inode_lsm_get(inode); - if (lsm == NULL) - RETURN(rc); - - rc = obd_find_cbdata(sbi->ll_dt_exp, lsm, return_if_equal, NULL); - ccc_inode_lsm_put(inode, lsm); - - RETURN(rc); -} - /** * Called when last reference to a dentry is dropped and dcache wants to know * whether or not it should cache it: @@ -183,17 +150,6 @@ static int ll_ddelete(HAVE_D_DELETE_CONST struct dentry *de) LASSERT(ll_d_count(de) == 1); #endif - /* Disable this piece of code temproarily because this is called - * inside dcache_lock so it's not appropriate to do lots of work - * here. ATTENTION: Before this piece of code enabling, LU-2487 must be - * resolved. */ -#if 0 - /* if not ldlm lock for this inode, set i_nlink to 0 so that - * this inode can be recycled later b=20433 */ - if (de->d_inode && !find_cbdata(de->d_inode)) - clear_nlink(de->d_inode); -#endif - if (d_lustre_invalid((struct dentry *)de)) RETURN(1); RETURN(0); @@ -236,26 +192,26 @@ int ll_d_init(struct dentry *de) void ll_intent_drop_lock(struct lookup_intent *it) { - if (it->it_op && it->d.lustre.it_lock_mode) { + if (it->it_op && it->it_lock_mode) { struct lustre_handle handle; - handle.cookie = it->d.lustre.it_lock_handle; + handle.cookie = it->it_lock_handle; - CDEBUG(D_DLMTRACE, "releasing lock with cookie "LPX64 - " from it %p\n", handle.cookie, it); - ldlm_lock_decref(&handle, it->d.lustre.it_lock_mode); + CDEBUG(D_DLMTRACE, "releasing lock with cookie %#llx from it %p\n", + handle.cookie, it); + ldlm_lock_decref(&handle, it->it_lock_mode); - /* bug 494: intent_release may be called multiple times, from - * this thread and we don't want to double-decref this lock */ - it->d.lustre.it_lock_mode = 0; - if (it->d.lustre.it_remote_lock_mode != 0) { - handle.cookie = it->d.lustre.it_remote_lock_handle; + /* bug 494: intent_release may be called multiple times, from + * this thread and we don't want to double-decref this lock */ + it->it_lock_mode = 0; + if (it->it_remote_lock_mode != 0) { + handle.cookie = it->it_remote_lock_handle; CDEBUG(D_DLMTRACE, "releasing remote lock with cookie" - LPX64" from it %p\n", handle.cookie, it); + "%#llx from it %p\n", handle.cookie, it); ldlm_lock_decref(&handle, - it->d.lustre.it_remote_lock_mode); - it->d.lustre.it_remote_lock_mode = 0; + it->it_remote_lock_mode); + it->it_remote_lock_mode = 0; } } } @@ -268,14 +224,14 @@ void ll_intent_release(struct lookup_intent *it) ll_intent_drop_lock(it); /* We are still holding extra reference on a request, need to free it */ if (it_disposition(it, DISP_ENQ_OPEN_REF)) - ptlrpc_req_finished(it->d.lustre.it_data); /* ll_file_open */ + ptlrpc_req_finished(it->it_request); /* ll_file_open */ - if (it_disposition(it, DISP_ENQ_CREATE_REF)) /* create rec */ - ptlrpc_req_finished(it->d.lustre.it_data); + if (it_disposition(it, DISP_ENQ_CREATE_REF)) /* create rec */ + ptlrpc_req_finished(it->it_request); - it->d.lustre.it_disposition = 0; - it->d.lustre.it_data = NULL; - EXIT; + it->it_disposition = 0; + it->it_request = NULL; + EXIT; } void ll_invalidate_aliases(struct inode *inode) @@ -290,7 +246,7 @@ void ll_invalidate_aliases(struct inode *inode) PFID(ll_inode2fid(inode)), inode); ll_lock_dcache(inode); - ll_d_hlist_for_each_entry(dentry, p, &inode->i_dentry, d_alias) { + ll_d_hlist_for_each_entry(dentry, p, &inode->i_dentry) { CDEBUG(D_DENTRY, "dentry in drop %.*s (%p) parent %p " "inode %p flags %d\n", dentry->d_name.len, dentry->d_name.name, dentry, dentry->d_parent, @@ -334,7 +290,7 @@ void ll_lookup_finish_locks(struct lookup_intent *it, struct dentry *dentry) LASSERT(it != NULL); LASSERT(dentry != NULL); - if (it->d.lustre.it_lock_mode && dentry->d_inode != NULL) { + if (it->it_lock_mode && dentry->d_inode != NULL) { struct inode *inode = dentry->d_inode; struct ll_sb_info *sbi = ll_i2sbi(dentry->d_inode); @@ -364,16 +320,20 @@ static int ll_revalidate_dentry(struct dentry *dentry, return 1; /* Symlink - always valid as long as the dentry was found */ +#ifdef HAVE_IOP_GET_LINK + if (dentry->d_inode && dentry->d_inode->i_op->get_link) +#else if (dentry->d_inode && dentry->d_inode->i_op->follow_link) +#endif return 1; - /* Last path component lookup for open or create - we always - * return 0 here to go through re-lookup and properly signal - * MDS whenever we do or do not want an open-cache to be engaged. - * For create we also ensure the entry is really created no matter - * what races might have happened. - * LU-4367 */ - if (lookup_flags & (LOOKUP_OPEN | LOOKUP_CREATE)) + /* + * VFS warns us that this is the second go around and previous + * operation failed (most likely open|creat), so this time + * we better talk to the server via the lookup path by name, + * not by fid. + */ + if (lookup_flags & LOOKUP_REVAL) return 0; if (!dentry_may_statahead(dir, dentry)) @@ -424,18 +384,9 @@ static int ll_revalidate_nd(struct dentry *dentry, struct nameidata *nd) } #endif -static void ll_d_iput(struct dentry *de, struct inode *inode) -{ - LASSERT(inode); - if (!find_cbdata(inode)) - clear_nlink(inode); - iput(inode); -} - const struct dentry_operations ll_d_ops = { .d_revalidate = ll_revalidate_nd, .d_release = ll_release, .d_delete = ll_ddelete, - .d_iput = ll_d_iput, .d_compare = ll_dcompare, };