From: adilger Date: Mon, 22 Jul 2002 18:35:19 +0000 (+0000) Subject: Add beginning of symlink support. Not totally functional yet, but not totally X-Git-Tag: v1_7_100~5253 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=3c659fe3b17f58a74cf669e04ca1d8f3f6b8e3fc;p=fs%2Flustre-release.git Add beginning of symlink support. Not totally functional yet, but not totally broken either. --- diff --git a/lustre/ldlm/ldlm_lock.c b/lustre/ldlm/ldlm_lock.c index 9b02d18..75c3cf3 100644 --- a/lustre/ldlm/ldlm_lock.c +++ b/lustre/ldlm/ldlm_lock.c @@ -283,16 +283,17 @@ static int ldlm_intent_policy(struct ldlm_lock *lock, void *req_cookie, * a file and its obdo */ case IT_CREAT: case IT_CREAT|IT_OPEN: + case IT_LINK: + case IT_LOOKUP: case IT_MKDIR: - case IT_SYMLINK: case IT_MKNOD: - case IT_LINK: case IT_OPEN: + case IT_READLINK: case IT_RENAME: + case IT_RMDIR: case IT_SETATTR: - case IT_LOOKUP: + case IT_SYMLINK: case IT_UNLINK: - case IT_RMDIR: bufcount = 3; break; case IT_RENAME2: @@ -316,13 +317,13 @@ static int ldlm_intent_policy(struct ldlm_lock *lock, void *req_cookie, switch (it->opc) { case IT_CREAT: case IT_CREAT|IT_OPEN: + case IT_LINK: case IT_MKDIR: - case IT_SYMLINK: case IT_MKNOD: - case IT_LINK: - case IT_UNLINK: - case IT_RMDIR: case IT_RENAME2: + case IT_RMDIR: + case IT_SYMLINK: + case IT_UNLINK: rc = mds_reint_p(2, req); if (rc || req->rq_status != 0) { rep->lock_policy_res2 = req->rq_status; @@ -330,11 +331,12 @@ static int ldlm_intent_policy(struct ldlm_lock *lock, void *req_cookie, } break; case IT_GETATTR: + case IT_LOOKUP: + case IT_OPEN: case IT_READDIR: + case IT_READLINK: case IT_RENAME: - case IT_OPEN: case IT_SETATTR: - case IT_LOOKUP: rc = mds_getattr_name_p(2, req); /* FIXME: we need to sit down and decide on who should * set req->rq_status, who should return negative and @@ -352,7 +354,7 @@ static int ldlm_intent_policy(struct ldlm_lock *lock, void *req_cookie, LBUG(); } - if (it->opc == IT_UNLINK || it->opc == IT_RMDIR || + if (it->opc == IT_UNLINK || it->opc == IT_RMDIR || it->opc == IT_RENAME || it->opc == IT_RENAME2) RETURN(ELDLM_LOCK_ABORTED); diff --git a/lustre/llite/namei.c b/lustre/llite/namei.c index a14fd5d..a5d3435 100644 --- a/lustre/llite/namei.c +++ b/lustre/llite/namei.c @@ -104,7 +104,7 @@ int ll_lock(struct inode *dir, struct dentry *dentry, IT_MKNOD))) lock_mode = LCK_PW; else if (it->it_op & (IT_READDIR | IT_GETATTR | IT_OPEN | IT_UNLINK | - IT_RMDIR | IT_RENAME | IT_RENAME2)) + IT_RMDIR | IT_RENAME | IT_RENAME2 | IT_READLINK)) lock_mode = LCK_PR; else if (it->it_op & IT_LOOKUP) lock_mode = LCK_CR; @@ -444,13 +444,18 @@ static int ll_symlink(struct inode *dir, struct dentry *dentry, oinfo = ll_i2info(inode); + if (dentry->d_it->it_disposition) { + d_instantiate(dentry, inode); + return 0; + } + OBD_ALLOC(oinfo->lli_symlink_name, l + 1); + if (!oinfo->lli_symlink_name) + RETURN(-ENOMEM); + memcpy(oinfo->lli_symlink_name, symname, l + 1); inode->i_size = l; - ext2_inc_count(inode); - atomic_inc(&inode->i_count); - return ext2_add_nondir(dentry, inode); }