From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jan Hudec Subject: Re: file system writes Date: Thu, 13 Jan 2005 22:31:50 +0100 Message-ID: <20050113213150.GC16884@vagabond> References: <20050113165353.GB24377@lst.de> <1105641344.2901.19.camel@ENERGY> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="ABTtc+pdwF7KHXCz" Cc: linux-fsdevel@vger.kernel.org Return-path: Received: from cimice4.lam.cz ([212.71.168.94]:23973 "EHLO vagabond.light.src") by vger.kernel.org with ESMTP id S261726AbVAMVb6 (ORCPT ); Thu, 13 Jan 2005 16:31:58 -0500 To: jenn Content-Disposition: inline In-Reply-To: <1105641344.2901.19.camel@ENERGY> Sender: linux-fsdevel-owner@vger.kernel.org List-Id: linux-fsdevel.vger.kernel.org --ABTtc+pdwF7KHXCz Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Jan 13, 2005 at 10:35:44 -0800, jenn wrote: > Hello, >=20 > I had a question I hoped someone could answer. >=20 > I am modifying reiserfs code. I have added code to the fs that writes > kernel data to a file on the same system. On mount, I make a file by > creating a dentry, and then calling i_op->create. I then release the > dentry. Everything appears to work fine I can see the file on the system > and open it etc...=20 >=20 > I try to write data to this file after creating it like this:=20 >=20 > I make a file pointer > I call filp_open with the name of the file > I call set_fs (to tell it it is a kernel address) > I call fp->f_op->write=20 > I call filp_close >=20 > The write operation returns successfully but no data appears in the > file. I open it and it is empty. It does work if I try to write to a > file on another system though... like I can write to etc/ or /opt. >=20 > Brahhhh... >=20 > If anyone has some ideas thanks! Is the whole world gone mad? Why is everybody trying to write files from kernel?? I was said many times here, that it's forbidden to write to files in kernel. What are you actualy trying to do?? That being said, it's doable and you are on the right track. Some stupid mistake like forgetting to call fput perhaps? But of course, I can't repeat it enough: FILES MUST NOT BE READ NOR WRITTEN BY KERNEL! ---------------------------------------------------------------------------= ---- Jan 'Bulb' Hudec --ABTtc+pdwF7KHXCz Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.5 (GNU/Linux) iD8DBQFB5ujGRel1vVwhjGURAlYoAKChtGLRb3WF1GQqCUPXe4XQR7LsTgCfRTiz R4aFPtbuya73mvjjVD3DR/k= =XABT -----END PGP SIGNATURE----- --ABTtc+pdwF7KHXCz--