diff options
author | Miklos Szeredi <mszeredi@suse.cz> | 2012-06-05 09:10:32 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2012-07-14 08:33:28 -0400 |
commit | a8277b9baa6268de386529a33061775bc716198b (patch) | |
tree | cdd127a78f7055b873ff79b2afdbb8d74382aac4 | |
parent | f60dc3db6e24b7c36445cf1feb56b34c799074b3 (diff) |
vfs: move O_DIRECT check to common code
Perform open_check_o_direct() in a common place in do_last after opening the
file.
Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
-rw-r--r-- | fs/namei.c | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/fs/namei.c b/fs/namei.c index 183a769537fe..4bc4bc6a6938 100644 --- a/fs/namei.c +++ b/fs/namei.c | |||
@@ -2305,22 +2305,15 @@ static struct file *atomic_open(struct nameidata *nd, struct dentry *dentry, | |||
2305 | * here. | 2305 | * here. |
2306 | */ | 2306 | */ |
2307 | error = may_open(&filp->f_path, acc_mode, open_flag); | 2307 | error = may_open(&filp->f_path, acc_mode, open_flag); |
2308 | if (error) | 2308 | if (error) { |
2309 | goto out_fput; | 2309 | fput(filp); |
2310 | 2310 | filp = ERR_PTR(error); | |
2311 | error = open_check_o_direct(filp); | 2311 | } |
2312 | if (error) | ||
2313 | goto out_fput; | ||
2314 | 2312 | ||
2315 | out: | 2313 | out: |
2316 | dput(dentry); | 2314 | dput(dentry); |
2317 | return filp; | 2315 | return filp; |
2318 | 2316 | ||
2319 | out_fput: | ||
2320 | fput(filp); | ||
2321 | filp = ERR_PTR(error); | ||
2322 | goto out; | ||
2323 | |||
2324 | no_open: | 2317 | no_open: |
2325 | if (need_lookup) { | 2318 | if (need_lookup) { |
2326 | dentry = lookup_real(dir, dentry, nd); | 2319 | dentry = lookup_real(dir, dentry, nd); |
@@ -2619,10 +2612,10 @@ finish_open_created: | |||
2619 | goto stale_open; | 2612 | goto stale_open; |
2620 | goto out; | 2613 | goto out; |
2621 | } | 2614 | } |
2615 | opened: | ||
2622 | error = open_check_o_direct(filp); | 2616 | error = open_check_o_direct(filp); |
2623 | if (error) | 2617 | if (error) |
2624 | goto exit_fput; | 2618 | goto exit_fput; |
2625 | opened: | ||
2626 | error = ima_file_check(filp, op->acc_mode); | 2619 | error = ima_file_check(filp, op->acc_mode); |
2627 | if (error) | 2620 | if (error) |
2628 | goto exit_fput; | 2621 | goto exit_fput; |