linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jan Hudec <bulb@ucw.cz>
To: jenn <sirpj@ecs.csus.edu>
Cc: linux-fsdevel@vger.kernel.org
Subject: Re: file system writes
Date: Thu, 13 Jan 2005 22:31:50 +0100	[thread overview]
Message-ID: <20050113213150.GC16884@vagabond> (raw)
In-Reply-To: <1105641344.2901.19.camel@ENERGY>

[-- Attachment #1: Type: text/plain, Size: 1494 bytes --]

On Thu, Jan 13, 2005 at 10:35:44 -0800, jenn wrote:
> Hello,
> 
> I had a question I hoped someone could answer.
> 
> 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... 
> 
> I try to write data to this file after creating it like this: 
> 
> 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 
> I call filp_close
> 
> 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.
> 
> Brahhhh...
> 
> 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 <bulb@ucw.cz>

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

  reply	other threads:[~2005-01-13 21:31 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-01-13 16:53 [PATCH] factor out common code around ->follow_link invocation Christoph Hellwig
2005-01-13 18:35 ` file system writes jenn
2005-01-13 21:31   ` Jan Hudec [this message]
2005-01-14  0:11     ` jenn
2005-01-14  0:06 ` [PATCH] factor out common code around ->follow_link invocation Andrew Morton
2005-01-14  0:21   ` Al Viro
2005-01-14  0:34     ` Andrew Morton
2005-01-14  0:38       ` Al Viro

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20050113213150.GC16884@vagabond \
    --to=bulb@ucw.cz \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=sirpj@ecs.csus.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).