Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 287840 - Make samba run ioniced.
Summary: Make samba run ioniced.
Status: CONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: High enhancement (vote)
Assignee: Gentoo's SAMBA Team
URL: http://linux.die.net/man/1/ionice
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-10-06 01:30 UTC by Nebojsa Trpkovic
Modified: 2021-01-02 18:50 UTC (History)
3 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Nebojsa Trpkovic 2009-10-06 01:30:44 UTC
it should be very nice to see ionice setting in /etc/conf.d/samba

http://linux.die.net/man/1/ionice
Comment 1 Justin Lecher (RETIRED) gentoo-dev 2009-10-07 19:17:58 UTC
Please give an example what you actually want.
Comment 2 Nebojsa Trpkovic 2009-10-08 00:18:59 UTC
I've put my ionice level manualy into the /etc/init.d/samba script.
I guess it's would be great to have something like "IONICE_CLASS" (default=none) and "IONICE_PRORITY" (default=none) in /etc/conf.d/samba


my /etc/init.d/samba (only thing that is different is "ionice -c 3" in front of "${cmd_exec} > /dev/null"):

######################################################
#!/sbin/runscript
# Copyright 1999-2007 Gentoo Foundation
# Distributed under the terms of the GNU General Public License, v2 or later
# $Header: /var/cvsroot/gentoo-x86/net-fs/samba-server/files/3.3/samba.initd,v 1.1 2009/06/26 20:24:11 patrick Exp $

opts="reload"

depend() {
        after slapd
        need net
        use cupsd
}

DAEMONNAME="${SVCNAME##samba.}"
[ "${DAEMONNAME}" != "samba" ] && daemon_list=${DAEMONNAME}

signal_do() {
        local signal="$1"
        [ -z "${signal}" ] && return 0

        local result=0 last_result=0 daemon= cmd_exec=
        for daemon in ${daemon_list} ; do
                eval cmd_exec=\$${daemon}_${signal}
                if [ -n "${cmd_exec}" ]; then
                        ebegin "${my_service_name} -> ${signal}: ${daemon}"
                        #echo ${cmd} '->' ${!cmd}
                        ionice -c 3 ${cmd_exec} > /dev/null
                        last_result=$?
                        eend ${last_result}
                fi
                result=$(( ${result} + ${last_result} ))
        done
        return ${result}
}
start() {
        ${my_service_PRE}
        signal_do start && return 0

        eerror "Error: starting services (see system logs)"
        signal_do stop
        return 1
}
stop() {
        ${my_service_PRE}
        if signal_do stop ; then
            ${my_service_POST}
            return 0
        fi
}
reload() {
        ${my_service_PRE}
        signal_do reload
}
######################################################


my LAN is 1Gbps. I have a lot of big files on my samba shares. if someone start copying at ~100MB/s, my desktop will almost hang until the end of the transfer.
this way, requests for my samba server are served only when my disk is idle.
it's just an example. this example, obviously, will not satisfy everybody's needs, but that's the reason to put option to prioritize or not samba disk accesses based on custom decision.

Comment 3 Justin Lecher (RETIRED) gentoo-dev 2009-10-08 07:06:11 UTC
Thanks alot for the description, assigning to maintainers
Comment 4 Patrick Lauer gentoo-dev 2009-10-09 17:52:06 UTC
In general I don't see the need for this. For almost all users samba is supposed to work at full speed.
Comment 5 Nebojsa Trpkovic 2009-10-09 23:22:56 UTC
ok, then set some reasonable defaults, but let us change that if we need to.

samba is not run on servers only any more. a lot of desktop users use it, too.

Comment 6 Marcin Mirosław 2016-11-21 12:37:21 UTC
Openrc supports setting ionice per service:
# Or the ionice level. The format is class[:data] , just like the
# --ionice start-stop-daemon parameter.
#SSD_IONICELEVEL="2:2"

This bug can be closed.
Comment 7 Stijn Tintel 2021-01-02 18:50:02 UTC
(In reply to Marcin Mirosław from comment #6)
> Openrc supports setting ionice per service:
> # Or the ionice level. The format is class[:data] , just like the
> # --ionice start-stop-daemon parameter.
> #SSD_IONICELEVEL="2:2"
> 
> This bug can be closed.

Unfortunately this doesn't seem to work:

ministore ~ # pgrep samba | while read f ; do ionice -p $f; done
none: prio 0
none: prio 4
none: prio 0
none: prio 4
none: prio 4
none: prio 0
none: prio 4
none: prio 4
none: prio 4
none: prio 0
none: prio 4
none: prio 0
none: prio 4
none: prio 4
none: prio 4
none: prio 0
none: prio 4
none: prio 0
none: prio 4
none: prio 4
none: prio 4
none: prio 0
none: prio 4
none: prio 4
none: prio 4
none: prio 4
none: prio 4
none: prio 0
none: prio 4
none: prio 0
none: prio 4
none: prio 0
none: prio 4
none: prio 0
none: prio 0
none: prio 4
none: prio 0
none: prio 4
none: prio 0
none: prio 4
none: prio 0
none: prio 4
none: prio 0
none: prio 4
none: prio 4
none: prio 4
none: prio 0
none: prio 4
none: prio 0
none: prio 4
none: prio 0
none: prio 4
none: prio 0
ministore ~ # grep SSD /etc/conf.d/samba
SSD_IONICELEVEL="1:0"