From 2f58d0e48dd7b47d993bdb6de327327b579a7ad1 Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Mon, 23 Nov 2020 15:54:35 +0000 Subject: [PATCH] scst: Remove superfluous get_fs() and set_fs() calls Calling set_fs(KERNEL_DS) before calling path_lookup() or kern_path() is not necessary since the arguments of these functions point at kernel data. Hence remove the get_fs() / set_fs() calls from around these function calls. git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@9187 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- scst/src/dev_handlers/scst_vdisk.c | 7 ------- scst/src/scst_lib.c | 5 ----- 2 files changed, 12 deletions(-) diff --git a/scst/src/dev_handlers/scst_vdisk.c b/scst/src/dev_handlers/scst_vdisk.c index 22c9bda8d..33672d14d 100644 --- a/scst/src/dev_handlers/scst_vdisk.c +++ b/scst/src/dev_handlers/scst_vdisk.c @@ -10081,12 +10081,9 @@ static int __init vdev_check_mode_pages_path(void) #else struct path path; #endif - mm_segment_t old_fs = get_fs(); TRACE_ENTRY(); - set_fs(KERNEL_DS); - #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 39) res = path_lookup(VDEV_MODE_PAGES_DIR, 0, &nd); if (res == 0) @@ -10101,12 +10098,8 @@ static int __init vdev_check_mode_pages_path(void) "disabled. You should create this directory manually " "or reinstall SCST", VDEV_MODE_PAGES_DIR, res); vdev_saved_mode_pages_enabled = false; - goto out_setfs; } -out_setfs: - set_fs(old_fs); - res = 0; /* always succeed */ TRACE_EXIT_RES(res); diff --git a/scst/src/scst_lib.c b/scst/src/scst_lib.c index 2f969b669..7471e2edb 100644 --- a/scst/src/scst_lib.c +++ b/scst/src/scst_lib.c @@ -15235,12 +15235,9 @@ int scst_remove_file(const char *name) #else struct path path; #endif - mm_segment_t old_fs = get_fs(); TRACE_ENTRY(); - set_fs(KERNEL_DS); - #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 39) res = path_lookup(name, 0, &nd); if (!res) @@ -15255,8 +15252,6 @@ int scst_remove_file(const char *name) TRACE_DBG("Unable to lookup file '%s' - error %d", name, res); #endif - set_fs(old_fs); - TRACE_EXIT_RES(res); return res; }