2000-10-28 14:33:15

by Oliver Neukum

[permalink] [raw]
Subject: question on SMP and read()/write()

Hi,

I've noticed that sys_read() and sys_write() don't grab the big kernel lock.
As file descriptors may be shared, must device drivers provide SMP safe
read() and write() methods ?

TIA
Oliver


2000-10-28 15:44:28

by Oliver Neukum

[permalink] [raw]
Subject: Re: question on SMP and read()/write()

On Saturday 28 October 2000 16:43, you wrote:
> > I've noticed that sys_read() and sys_write() don't grab the big kernel
> > lock. As file descriptors may be shared, must device drivers provide SMP
> > safe read() and write() methods ?
>
> no. FD's refer to files; block drivers don't, and the nontrivial
> code between sys_* and drivers deals with this sort of thing.

Sure block drivers need not do this, but how about drivers for character
devices ? It seems that sys_read() calls a function provided by the
f_op table without any locking. Isn't this the function a driver for a
character device must provide to the VFS ?

TIA
Oliver

2000-10-28 16:18:18

by Alan

[permalink] [raw]
Subject: Re: question on SMP and read()/write()

> I've noticed that sys_read() and sys_write() don't grab the big kernel lock.
> As file descriptors may be shared, must device drivers provide SMP safe
> read() and write() methods ?

Yes. This is true in 2.2 as well although the inode lock provides some protection
on writes.