From mboxrd@z Thu Jan 1 00:00:00 1970 From: Eric Van Hensbergen Subject: Re: [V9fs-developer] [PATCH 3/3] 9p: add 9P2000.L unlinkat operation Date: Mon, 13 Jun 2011 16:12:52 -0500 Message-ID: References: <1307383308-5773-1-git-send-email-aneesh.kumar@linux.vnet.ibm.com> <1307383308-5773-3-git-send-email-aneesh.kumar@linux.vnet.ibm.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: v9fs-developer@lists.sourceforge.net, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org To: "Aneesh Kumar K.V" Return-path: Received: from mail-fx0-f52.google.com ([209.85.161.52]:44263 "EHLO mail-fx0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753322Ab1FMVTp convert rfc822-to-8bit (ORCPT ); Mon, 13 Jun 2011 17:19:45 -0400 In-Reply-To: <1307383308-5773-3-git-send-email-aneesh.kumar@linux.vnet.ibm.com> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: Could be wrong, but a quick regression check of your patches fails against a legacy server. Are you making sure the new operations are properly protected by a .L flag? -eric On Mon, Jun 6, 2011 at 1:01 PM, Aneesh Kumar K.V wrote: > unlinkat - Remove a directory entry > > size[4] Tunlinkat tag[2] dirfid[4] name[s] flag[4] > size[4] Runlinkat tag[2] > > older Tremove have the below request format > > size[4] Tremove tag[2] fid[4] > > The remove message is used to remove a directory entry either file or= directory > The remove opreation is actually a directory opertation and should id= eally have > dirfid, if not we cannot represent the fid on server with anything ot= her than > name. We will have to derive the directory name from fid in the Tremo= ve request. > > NOTE: The operation doesn't clunk the unlink fid. > > Signed-off-by: Aneesh Kumar K.V > --- > =A0fs/9p/vfs_inode.c =A0 =A0 =A0 | =A0 43 ++++++++++++++++++++++++++-= ---------------- > =A0include/net/9p/9p.h =A0 =A0 | =A0 =A02 ++ > =A0include/net/9p/client.h | =A0 =A01 + > =A0net/9p/client.c =A0 =A0 =A0 =A0 | =A0 23 +++++++++++++++++++++++ > =A04 files changed, 52 insertions(+), 17 deletions(-) > > diff --git a/fs/9p/vfs_inode.c b/fs/9p/vfs_inode.c > index ded6309..f40fdc3 100644 > --- a/fs/9p/vfs_inode.c > +++ b/fs/9p/vfs_inode.c > @@ -492,38 +492,47 @@ v9fs_inode_from_fid(struct v9fs_session_info *v= 9ses, struct p9_fid *fid, > =A0/** > =A0* v9fs_remove - helper function to remove files and directories > =A0* @dir: directory inode that is being deleted > - * @file: =A0dentry that is being deleted > + * @dentry: =A0dentry that is being deleted > =A0* @rmdir: removing a directory > =A0* > =A0*/ > > -static int v9fs_remove(struct inode *dir, struct dentry *file, int r= mdir) > +static int v9fs_remove(struct inode *dir, struct dentry *dentry, int= flags) > =A0{ > =A0 =A0 =A0 =A0int retval; > - =A0 =A0 =A0 struct p9_fid *v9fid; > - =A0 =A0 =A0 struct inode *file_inode; > - > - =A0 =A0 =A0 P9_DPRINTK(P9_DEBUG_VFS, "inode: %p dentry: %p rmdir: %= d\n", dir, file, > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 rmdir); > + =A0 =A0 =A0 struct inode *inode; > + =A0 =A0 =A0 struct p9_fid *v9fid, *dfid; > > - =A0 =A0 =A0 file_inode =3D file->d_inode; > - =A0 =A0 =A0 v9fid =3D v9fs_fid_clone(file); > - =A0 =A0 =A0 if (IS_ERR(v9fid)) > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 return PTR_ERR(v9fid); > + =A0 =A0 =A0 P9_DPRINTK(P9_DEBUG_VFS, "inode: %p dentry: %p rmdir: %= x\n", > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0dir, dentry, flags); > > - =A0 =A0 =A0 retval =3D p9_client_remove(v9fid); > + =A0 =A0 =A0 inode =3D dentry->d_inode; > + =A0 =A0 =A0 dfid =3D v9fs_fid_lookup(dentry->d_parent); > + =A0 =A0 =A0 if (IS_ERR(dfid)) { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 retval =3D PTR_ERR(dfid); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 P9_DPRINTK(P9_DEBUG_VFS, "fid lookup fa= iled %d\n", retval); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 return retval; > + =A0 =A0 =A0 } > + =A0 =A0 =A0 retval =3D p9_client_unlinkat(dfid, dentry->d_name.name= , flags); > + =A0 =A0 =A0 if (retval =3D=3D -EOPNOTSUPP) { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 /* Try the one based on path */ > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 v9fid =3D v9fs_fid_clone(dentry); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (IS_ERR(v9fid)) > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 return PTR_ERR(v9fid); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 retval =3D p9_client_remove(v9fid); > + =A0 =A0 =A0 } > =A0 =A0 =A0 =A0if (!retval) { > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0/* > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 * directories on unlink should have z= ero > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 * link count > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 */ > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (rmdir) { > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 clear_nlink(file_inode)= ; > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (flags & AT_REMOVEDIR) { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 clear_nlink(inode); > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0drop_nlink(dir); > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0} else > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 drop_nlink(file_inode); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 drop_nlink(inode); > > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 v9fs_invalidate_inode_attr(file_inode); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 v9fs_invalidate_inode_attr(inode); > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0v9fs_invalidate_inode_attr(dir); > =A0 =A0 =A0 =A0} > =A0 =A0 =A0 =A0return retval; > @@ -814,7 +823,7 @@ int v9fs_vfs_unlink(struct inode *i, struct dentr= y *d) > > =A0int v9fs_vfs_rmdir(struct inode *i, struct dentry *d) > =A0{ > - =A0 =A0 =A0 return v9fs_remove(i, d, 1); > + =A0 =A0 =A0 return v9fs_remove(i, d, AT_REMOVEDIR); > =A0} > > =A0/** > diff --git a/include/net/9p/9p.h b/include/net/9p/9p.h > index 094c3dd..fe1efa6 100644 > --- a/include/net/9p/9p.h > +++ b/include/net/9p/9p.h > @@ -177,6 +177,8 @@ enum p9_msg_t { > =A0 =A0 =A0 =A0P9_RMKDIR, > =A0 =A0 =A0 =A0P9_TRENAMEAT =3D 74, > =A0 =A0 =A0 =A0P9_RRENAMEAT, > + =A0 =A0 =A0 P9_TUNLINKAT =3D 76, > + =A0 =A0 =A0 P9_RUNLINKAT, > =A0 =A0 =A0 =A0P9_TVERSION =3D 100, > =A0 =A0 =A0 =A0P9_RVERSION, > =A0 =A0 =A0 =A0P9_TAUTH =3D 102, > diff --git a/include/net/9p/client.h b/include/net/9p/client.h > index 5353cbc..976d12a 100644 > --- a/include/net/9p/client.h > +++ b/include/net/9p/client.h > @@ -234,6 +234,7 @@ int p9_client_create_dotl(struct p9_fid *ofid, ch= ar *name, u32 flags, u32 mode, > =A0int p9_client_clunk(struct p9_fid *fid); > =A0int p9_client_fsync(struct p9_fid *fid, int datasync); > =A0int p9_client_remove(struct p9_fid *fid); > +int p9_client_unlinkat(struct p9_fid *dfid, const char *name, int fl= ags); > =A0int p9_client_read(struct p9_fid *fid, char *data, char __user *ud= ata, > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0= =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0u64 offset, u32 count); > =A0int p9_client_write(struct p9_fid *fid, char *data, const char __u= ser *udata, > diff --git a/net/9p/client.c b/net/9p/client.c > index 677ae8d..d225158 100644 > --- a/net/9p/client.c > +++ b/net/9p/client.c > @@ -1281,6 +1281,29 @@ error: > =A0} > =A0EXPORT_SYMBOL(p9_client_remove); > > +int p9_client_unlinkat(struct p9_fid *dfid, const char *name, int fl= ags) > +{ > + =A0 =A0 =A0 int err =3D 0; > + =A0 =A0 =A0 struct p9_req_t *req; > + =A0 =A0 =A0 struct p9_client *clnt; > + > + =A0 =A0 =A0 P9_DPRINTK(P9_DEBUG_9P, ">>> TUNLINKAT fid %d %s %d\n", > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0dfid->fid, name, flags); > + > + =A0 =A0 =A0 clnt =3D dfid->clnt; > + =A0 =A0 =A0 req =3D p9_client_rpc(clnt, P9_TUNLINKAT, "dsd", dfid->= fid, name, flags); > + =A0 =A0 =A0 if (IS_ERR(req)) { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 err =3D PTR_ERR(req); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 goto error; > + =A0 =A0 =A0 } > + =A0 =A0 =A0 P9_DPRINTK(P9_DEBUG_9P, "<<< RUNLINKAT fid %d %s\n", df= id->fid, name); > + > + =A0 =A0 =A0 p9_free_req(clnt, req); > +error: > + =A0 =A0 =A0 return err; > +} > +EXPORT_SYMBOL(p9_client_unlinkat); > + > =A0int > =A0p9_client_read(struct p9_fid *fid, char *data, char __user *udata,= u64 offset, > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0= =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0u32 count) > -- > 1.7.4.1 > > > ---------------------------------------------------------------------= --------- > Simplify data backup and recovery for your virtual environment with v= Ranger. > Installation's a snap, and flexible recovery options mean your data i= s safe, > secure and there when you need it. Discover what all the cheering's a= bout. > Get your free trial download today. > http://p.sf.net/sfu/quest-dev2dev2 > _______________________________________________ > V9fs-developer mailing list > V9fs-developer@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/v9fs-developer > -- To unsubscribe from this list: send the line "unsubscribe linux-fsdevel= " in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html