Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
linux
Commits
eb09d3d4
Commit
eb09d3d4
authored
May 15, 2008
by
Jonathan Corbet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
sg: cdev lock_kernel() pushdown
Signed-off-by:
Jonathan Corbet
<
corbet@lwn.net
>
parent
04f4ac9d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
3 deletions
+13
-3
drivers/scsi/sg.c
drivers/scsi/sg.c
+13
-3
No files found.
drivers/scsi/sg.c
View file @
eb09d3d4
...
@@ -49,6 +49,7 @@ static int sg_version_num = 30534; /* 2 digits for each component */
...
@@ -49,6 +49,7 @@ static int sg_version_num = 30534; /* 2 digits for each component */
#include <linux/delay.h>
#include <linux/delay.h>
#include <linux/scatterlist.h>
#include <linux/scatterlist.h>
#include <linux/blktrace_api.h>
#include <linux/blktrace_api.h>
#include <linux/smp_lock.h>
#include "scsi.h"
#include "scsi.h"
#include <scsi/scsi_dbg.h>
#include <scsi/scsi_dbg.h>
...
@@ -227,19 +228,26 @@ sg_open(struct inode *inode, struct file *filp)
...
@@ -227,19 +228,26 @@ sg_open(struct inode *inode, struct file *filp)
int
res
;
int
res
;
int
retval
;
int
retval
;
lock_kernel
();
nonseekable_open
(
inode
,
filp
);
nonseekable_open
(
inode
,
filp
);
SCSI_LOG_TIMEOUT
(
3
,
printk
(
"sg_open: dev=%d, flags=0x%x
\n
"
,
dev
,
flags
));
SCSI_LOG_TIMEOUT
(
3
,
printk
(
"sg_open: dev=%d, flags=0x%x
\n
"
,
dev
,
flags
));
sdp
=
sg_get_dev
(
dev
);
sdp
=
sg_get_dev
(
dev
);
if
((
!
sdp
)
||
(
!
sdp
->
device
))
if
((
!
sdp
)
||
(
!
sdp
->
device
))
{
unlock_kernel
();
return
-
ENXIO
;
return
-
ENXIO
;
if
(
sdp
->
detached
)
}
if
(
sdp
->
detached
)
{
unlock_kernel
();
return
-
ENODEV
;
return
-
ENODEV
;
}
/* This driver's module count bumped by fops_get in <linux/fs.h> */
/* This driver's module count bumped by fops_get in <linux/fs.h> */
/* Prevent the device driver from vanishing while we sleep */
/* Prevent the device driver from vanishing while we sleep */
retval
=
scsi_device_get
(
sdp
->
device
);
retval
=
scsi_device_get
(
sdp
->
device
);
if
(
retval
)
if
(
retval
)
{
unlock_kernel
();
return
retval
;
return
retval
;
}
if
(
!
((
flags
&
O_NONBLOCK
)
||
if
(
!
((
flags
&
O_NONBLOCK
)
||
scsi_block_when_processing_errors
(
sdp
->
device
)))
{
scsi_block_when_processing_errors
(
sdp
->
device
)))
{
...
@@ -295,10 +303,12 @@ sg_open(struct inode *inode, struct file *filp)
...
@@ -295,10 +303,12 @@ sg_open(struct inode *inode, struct file *filp)
retval
=
-
ENOMEM
;
retval
=
-
ENOMEM
;
goto
error_out
;
goto
error_out
;
}
}
unlock_kernel
();
return
0
;
return
0
;
error_out:
error_out:
scsi_device_put
(
sdp
->
device
);
scsi_device_put
(
sdp
->
device
);
unlock_kernel
();
return
retval
;
return
retval
;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment