From owner-freebsd-hackers Mon Feb 15 13:47:06 1999 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id NAA11599 for freebsd-hackers-outgoing; Mon, 15 Feb 1999 13:47:06 -0800 (PST) (envelope-from owner-freebsd-hackers@FreeBSD.ORG) Received: from lor.watermarkgroup.com (lor.watermarkgroup.com [207.202.73.33]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id NAA11586 for ; Mon, 15 Feb 1999 13:47:01 -0800 (PST) (envelope-from luoqi@watermarkgroup.com) Received: (from luoqi@localhost) by lor.watermarkgroup.com (8.8.8/8.8.8) id QAA14975; Mon, 15 Feb 1999 16:46:19 -0500 (EST) (envelope-from luoqi) Date: Mon, 15 Feb 1999 16:46:19 -0500 (EST) From: Luoqi Chen Message-Id: <199902152146.QAA14975@lor.watermarkgroup.com> To: dillon@apollo.backplane.com, hackers@FreeBSD.ORG Subject: Re: VOP_REMOVE() rules for freeing a_cnp ? Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG > I can't make heads or tails of the VOP_REMOVE() rules for freeing > a_cnp. > I guess you meant freeing a_cnp->cn_pnbuf. For VOP_REMOVE() shouldn't need to free pnbuf because it's already freed by namei itself (namei frees pnbuf unless SAVENAME or SAVESTART is set). > The man page doesn't say anything about having to free cnp. > > ufs_remove() doesn't bother. > This is correct. > nfs_remove() always frees it. > This is wrong. > And the unlink() system call seems to expect the cnp to be freed > by the VOP_REMOVE() function. > See above. > Typically the rule for freeing a struct componentname in a VOP > routine is 'free it if you return an error, otherwise only free > it if the SAVESTART flag is not set in cn_flags'. > Personally I feel it should be the caller's responsibility to free pnbuf, but not VOP routines', just as VOP routines shouldn't vrele any vnode arguments, otherwise implementation of stackable FS would be a nightmare. > I would appreciate it if a VFS guru could look at this junk and > tell me whos right. > > Matthew Dillon > > -lq To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message