cupsd wakes up the hard disk every 14 minutes
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
The Ubuntu Power Consumption Project |
Fix Released
|
Undecided
|
Unassigned | ||
cups (Ubuntu) |
Won't Fix
|
Undecided
|
Unassigned | ||
indicator-printers (Ubuntu) |
Fix Released
|
Undecided
|
Unassigned |
Bug Description
cupsd calls fsync() on /etc/subscripti
I think we don't need cupsdRemoveFile() to always overwrite data and do a fsync() for this file. Currently only Precise is confirmed to be affected. Saucy seems not having the same issue according to
(http://
---- block_dump from the kernel ----
<7>[19935.646436] cupsd(1066): dirtied inode 15336755 (subscriptions.
<7>[19935.646673] cupsd(1066): WRITE block 352753016 on sda3 (8 sectors)
<7>[19935.646755] cupsd(1066): dirtied inode 15335603 (?) on sda3
<7>[19935.646763] cupsd(1066): dirtied inode 15335603 (?) on sda3
<7>[19935.646776] cupsd(1066): WRITE block 352701128 on sda3 (8 sectors)
<7>[20774.607856] cupsd(1066): dirtied inode 15335603 (subscriptions.
<7>[20774.608034] cupsd(1066): WRITE block 352862776 on sda3 (8 sectors)
<7>[20774.608113] cupsd(1066): dirtied inode 15335607 (?) on sda3
<7>[20774.608120] cupsd(1066): dirtied inode 15335607 (?) on sda3
<7>[20774.608133] cupsd(1066): WRITE block 352753008 on sda3 (8 sectors)
<7>[21613.569033] cupsd(1066): dirtied inode 15335607 (subscriptions.
<7>[21613.569257] cupsd(1066): WRITE block 352753024 on sda3 (8 sectors)
<7>[21613.569345] cupsd(1066): dirtied inode 15336755 (?) on sda3
<7>[21613.569353] cupsd(1066): dirtied inode 15336755 (?) on sda3
<7>[21613.569367] cupsd(1066): WRITE block 352753016 on sda3 (8 sectors)
---- cups: scheduler/file.c ----
int /* O - 0 on success, -1 on error */
cupsdCloseCreat
cups_file_t *fp, /* I - File to close */
const char *filename) /* I - Filename */
{
...
snprintf(newfile, sizeof(newfile), "%s.N", filename);
snprintf(oldfile, sizeof(oldfile), "%s.O", filename);
if ((cupsdRemoveFi
(
rename(
{
cupsdLogMes
return (-1);
}
return (0);
}
int /* O - 0 on success, -1 on error */
cupsdRemoveFile
{
...
/*
* Overwrite the file 7 times with 0xF6, 0x00, 0xFF, random, 0x00, 0xFF,
* and more random data.
*/
memset(buffer, 0xF6, sizeof(buffer));
if (overwrite_data(fd, buffer, sizeof(buffer), (int)info.st_size))
{
close(fd);
return (-1);
}
...
}
static int /* O - 0 on success, -1 on error */
overwrite_data(int fd, /* I - File descriptor */
int bufsize, /* I - Size of buffer */
int filesize) /* I - Size of file */
{
int bytes; /* Bytes to write/written */
/*
* Start at the beginning of the file...
*/
if (lseek(fd, 0, SEEK_SET) < 0)
return (-1);
/*
* Fill the file with the provided data...
*/
while (filesize > 0)
{
if (filesize > bufsize)
bytes = bufsize;
else
bytes = filesize;
if ((bytes = write(fd, buffer, bytes)) < 0)
return (-1);
filesize -= bytes;
}
/*
* Force the changes to disk...
*/
return (fsync(fd));
}
---- indicator-
#define NOTIFY_
int main (int argc, char *argv[])
{
...
g_timeout_
...
}
Related branches
- Charles Kerr (community): Approve
- PS Jenkins bot (community): Approve (continuous-integration)
-
Diff: 12 lines (+1/-1)1 file modifiedsrc/indicator-printers-service.c (+1/-1)
description: | updated |
tags: | added: precise |
Changed in ubuntu-power-consumption: | |
status: | New → Fix Released |
Mike, can you have a look into this? The CUPS currently in Ubuntu 13.10 (Saucy, CUPS 1.7rc1) does not show this problem, but the CUPS in 12.04 LTS (Precise, CUPS 1.5.3) has this problem of an subscription renewal constantly waking up the system. Can you tell us which change fixed this, so that we can backport this change? Thanks.